以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  连续打印  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=152794)

--  作者:fendouww
--  发布时间:2020/7/22 14:58:00
--  连续打印
无法打印多张图片,只会打印第一张,求解?

With Tables("发票")
    Dim rs As List(of Row) = .GetCheckedRows
    If rs.Count > 0 Then
        Dim Result As DialogResult
        Result = MessageBox.Show("确定打印吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If Result = DialogResult.Yes Then
            Dim doc As New PrintDoc \'定义一个报表
            doc.PageSetting.PaperKind = 9
            doc.PageSetting.Landscape = True
            Doc.PageSetting.LeftMargin = 20 \'设置左边距
            Doc.PageSetting.RightMargin = 20 \'设置右边距
            Doc.PageSetting.TopMargin = 10 \'设置上边距
            Doc.PageSetting.BottomMargin = 10 \'设置下边距
            Dim rm As prt.RenderImage  \'定义一个图片对象
            For Each i As Row In rs
                If i("发票") IsNot Nothing Then
                    Dim fil As String  = i("发票")
                    Dim fi As String() = fil.Split(vbcrlf)
                    Dim file As String
                    For Each ff As String In fi                       
                        file =  "\\\\10.100.100.129\\产品中心\\foxtable资料\\发票\\" & ff
                        Dim img As image = getImage(file)
                        If img IsNot Nothing Then
                            rm = new prt.RenderImage
                            rm.Image = img \'请改为实际的图标名称和路径
                            rm.Width = "Parent.Width" \'宽度等于页面宽度
                            rm.Height = "Auto" \'高度由图片大小自动决定
                            \'rm.Style.ImageAlign.StretchHorz = False \'禁止图片水平拉伸
                            rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'居中显示
                            rm.BreakBefore = prt.BreakEnum.Page
                            doc.Body.Children.Add(rm) \'将表格对象加入到报表中
                            \'Doc.Preview()
                            \'Doc.PrinterName = "HP LaserJet 6L"
                        End If
                    Next
                End If
            Next
             doc.Print()
        End If
    End If
End With


--  作者:有点蓝
--  发布时间:2020/7/22 15:02:00
--  
Dim fi As String() = fil.replace(vbcr,"").Split(vblf)