Foxtable(狐表)用户栏目专家坐堂 → [求助] 显示打印页数


  共有1906人关注过本帖平板打印复制链接

主题:[求助] 显示打印页数

帅哥哟,离线,有人找我吗?
sanny
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:795 积分:5880 威望:0 精华:0 注册:2018/11/3 8:24:00
[求助] 显示打印页数  发帖心情 Post By:2020/9/22 8:06:00 [只看该作者]

老师,如附图,如何把打印预览中的页数加到如下代码中 ? 每张显示格式 “ 第xx页,总页数xx”,谢谢。

Dim count As Integer = 1
If InputValue(count, "提示", "打印多少次?") Then
    If count < = 100 Then
        Dim doc  As New PrintDoc
        doc.PageSetting.Width = 69  '
        doc.PageSetting.Height = 42
        Doc.PageSetting.LeftMargin = 3
        Doc.PageSetting.TopMargin = 3
        Doc.PageSetting.RightMargin = 0
        Dim t As Table = e.form.controls("Table1").Table
        
        For j As Integer = 1 To count
            
            For i As Integer = t.TopPosition To t.BottomPosition
                Dim r As Row = t.Rows(i)
                r("printtimes") = count
                r("printtime") = now ()
                
                
                Dim rt As New prt.RenderTable() '定义一个表格对象
                Dim rt1 As New prt.RenderText
                rt1.Style.FontBold = True
                rt.Style.FontSize = 10
                rt.Rows(0).Height = 6
                rt.Rows(1).Height = 6
                rt.Rows(2).Height = 6
                rt.Rows(3).Height = 6
                'rt.Rows(4).Height = 3
                
                rt.Style.Spacing.bottom = 3
                rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
                rt.Cols(0).Width = 25
                rt.Cols(1).Width = 45
                rt.cells(0,0).Text = "Customer:"
                rt.Cells(0,1).Text = r("EndCustomer")
                rt.Cells(1,0).Text= "Part No.:"
                rt.Cells(1,0).Style.WordWrap = False
                rt.cells(1,1).Text = r("PartNo")
                rt.Cells(2,0).Text= "GSS Part No.:"
                rt.cells(2,1).Text = r("GSSPart")
                rt.Cells(3,0).Text= "Qty:"
                rt.cells(3,1).Text = r("OpenQty")& "  PCS"
                
                rt.cells(4,0).SpanCols =2
                
                doc.Body.Children.Add(rt) '将表格对象加入到报表中
                Dim  rg As prt.RenderGraphics
                Dim  Bar As  New   BarCodeBuilder
                
                Bar.Symbology =   Barpro.Symbology.Code128
                bar.Code =  r("PartNo")
                Bar.Text = Date.Today
                rg =  new  prt.RenderGraphics
                rt.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center
                
                rg.Height = 12
                
                bar.DrawOnCanvas(rg.Graphics,0,0,1)
                rt.cells(4,0).RenderObject = rg
            Next
            
        Next
        
        doc.Preview()
        
        
        Dim t1 As Table = Tables("Orderlist")
        Dim nmb() As String = {"GSSAG_PO","Endcustomer","CustomerPO","GSSPart","PartNo","OpenQty","ETD","Printtimes","PrintTime"}
        Dim nma() As String = {"GSSAG_PO","Endcustomer","CustomerPO","GSSPart","PartNo","OPENQty","ETD","Printtimes","PrintTime"}
        
        For r As Integer = t1.TopPosition To t1.BottomPosition
            Dim dr As Row = Tables("PrintHistory").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr(nma(i)) = t1.rows(r)(nmb(i))
            Next
        Next
        
    Else
        msgbox("一次打印不可以大于100张")
        
    End If
End If

DataTables("PrintHistory").Save()
[此贴子已经被作者于2020/10/31 15:04:29编辑过]

 回到顶部