Foxtable(狐表)用户栏目专家坐堂 → 分组打印换页


  共有2111人关注过本帖树形打印复制链接

主题:分组打印换页

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


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/31 8:38:00 [显示全部帖子]

Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tb As Table = Tables("打印考试用表_table1")
Dim ColNames As String() = New String(){"考号", "姓名"}
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tb.DataTable.GetValues("班级")
Dim rm As prt.RenderEmpty
tb.sort = "班级,考号"
For Each Region As String In Regions
    rm = new prt.RenderEmpty '定义一个新的空对象
    rm.BreakBefore = prt.BreakEnum.Page '打印前换页
    doc.Body.Children.Add(rm)
    
    rx = New prt.RenderText
    rx.Style.FontSize = 14
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 2
    rx.Text = "班级: " & Region & "考号表"
    doc.Body.Children.Add(rx)
    rt = New prt.RenderTable
    Doc.PageSetting.LeftMargin = 10 '设置左边距
    Doc.PageSetting.RightMargin = 10 '设置右边距
    Doc.PageSetting.TopMargin = 10 '设置上边距
    Doc.PageSetting.BottomMargin = 10 '设置下边距
    rt.Cols(0).Width = 60
    rt.Cols(1).width = 50
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
    rt.Style.Spacing.Bottom = 2
    rt.CellStyle.Spacing.All = 1
    rt.Style.Font = New Font("宋体", 8, FontStyle.Bold) '设置字体
    rt.Style.Spacing.All = 1
    Rows = tb.DataTable.Select("[班级] = '" & Region & "'")
    For c As Integer = 0 To ColNames.Length - 1 '逐列设置和填入内容
        For r As Integer = 0 To tb.Rows.Count -1 '开始填入该列内容
            rt.Cells(r,c).Text = tb.Rows(r)(ColNames(c))
        Next
    Next
doc.Body.Children.Add(rt)
    '''' rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
Next
doc.Columns.Add()
doc.Columns.Add()

doc.preview()

 回到顶部