Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl= Tables("学生信息")
tbl.sort = "班级,学生姓名"
doc.PageSetting.Landscape = True
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetValues("班级") ''''改后句子
Dim rm As prt.RenderEmpty
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 5 '设置上边距
Doc.PageSetting.BottomMargin = 5 '设置下边距
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.Font = New Font("黑体", 16, FontStyle.Bold) '
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 2
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Text = Region & "学生基本信息表"
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
''rt.Width = "auto"
rt.Style.Font = New Font("宋体", 8)
Rows = tbl.DataTable.Select("[班级] ='" & region & "'", "学生姓名")
For c As Integer = 2 To tbl.Cols.Count -1 '
If tbl.Cols(c).Visible Then
rt.Cells(0,c-2).Text = tbl.Cols(c).Name
End If
Dim r As Integer
For r = 0 To Rows.Count -1
rt.Rows(0).Height = 5
rt.Rows(r+1).height = 4
rt.Cols(0).Width = 15
rt.Cols(4).Width = 60
rt.Cols(3).Width = 40
rt.Cols(2).Width = 36
If tbl.Cols(c).Visible Then
rt.Cells(r+1,c-2).Text = rows(r)(tbl.Cols(c).Name)
End If
Next
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Next
doc.preview()
老师,请问窗口中表格有过滤,但这个报表打印没过滤掉记录,请问如何改?谢谢