FlexCell用户自定义打印模板

'说明:现在只能加载一张图片
Private Sub Form_Load()
    Dim imageRow As Long    '图片所在的行
    Dim imageCol As Long    '图片所在的列
    Dim imagHeight As Long  '图片所在行的高度
    Dim ImageBln As Boolean    'True   存在有图片单元格
    With Grid1
         '——————————————————————————————————
         '说明:取得模块的基本信息
         ImageBln = False
         '加载文件
        .OpenFile "c:/1.cel"
        '判断表格是否存在有图片单元格,如果有,取得表格的宽度和高度
        For i = 1 To .Rows - 1
            For j = 1 To .Cols - 1
                If .Cell(i, j).ImageKey <> "" Then
                    imageRow = i '图片所在的行
                    imageCol = j '图片所在的列
                    imagHeight = .RowHeight(i)
                    ImageKey = .Cell(i, j).ImageKey '图片关键字
                    ImageBln = True '存在图片单元格
                End If
            Next
        Next
       
         '取得行数
         Row = .Rows - 1
        
         '选中,并复制
        .Range(1, 1, Row, .Cols - 1).Selected
        .Selection.CopyData
        .AutoRedraw = False
        '——————————————————————————————————
        '——————————————————————————————————
        '说明:加载数据
        For i = 1 To 10
            '插入行:和选中的行数一样
            .Selection.InsertRows
            .Range(1, 1, Row, .Cols - 1).Selected
            '选中粘贴数据
            .Selection.PasteData
            '判断是否存在有图片
            If ImageBln Then
                .Cell(imageRow, imageCol).SetImage ImageKey
                .RowHeight(imageRow) = imagHeight
            End If
            '分页符
            .HPageBreaks.Add Row + 1
        Next
        '——————————————————————————————————
         .Refresh
        .AutoRedraw = True
    End With
End Sub
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值