Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("统计_table1")
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetValues("班级")
''doc.Pagesetting.LandScape = True 设置横向打印
For Each Region As String In Regions
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.Width = "Parent.Width" '对象宽度等于页面宽度
''rt.Height = "Parent.Height" '对象高度等于页面高度
''rt.Width = 180 '设置表格的宽度为120毫米
''rt.Height = 280 '设置表格的高度为100毫米
rt.Style.Font = Tables("统计_table1").Font
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
rt.Style.Spacing.Bottom = 5
rt.CellStyle.Spacing.All = 1
rt.Style.Font = tbl.Font
Rows = tbl.DataTable.Select("[班级] = '" & Region & "'")
For c As Integer = 5 To tbl.Cols.Count - 1
rt.Cells(0,c-5).Text = tbl.Cols(c).Name
rt.Cols(c-5).Width = tbl.Cols(c).PrintWidth
For r As Integer = 0 To Rows.Count -1
rt.Cells(r + 1, c-5).Text = rows(r)(tbl.Cols(c).Name)
Next
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Next
doc.preview()
老师,打成绩表时要分班打,如果打完一个班后重新的一页开始,怎么改,谢谢