Dim tbl As Table = Tables("初中报名_table4")
Dim dr As DataRow= tbl.DataTable.find("[考试室] is null")
If dr IsNot Nothing
MessageBox.show("你的考试室设置没有完成,请设置好考试室再回来打印门牌")
Else
Dim doc As New PrintDoc
doc.PageSetting.Landscape = True
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim ColNames As String() = New String(){"年级","起始考号", "终止考号"}
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetValues("考试室") ''''改后句子
Dim rm As prt.RenderEmpty
Doc.PageSetting.LeftMargin = 20 '设置左边距
Doc.PageSetting.RightMargin = 20 '设置右边距
Doc.PageSetting.TopMargin = 50 '设置上边距
Doc.PageSetting.BottomMargin = 10 '设置下边距
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("黑体", 120, 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.Style.Spacing.Bottom = 2
rt.CellStyle.Spacing.All = 1
' rt.Height = 250
rt.Style.Font = New Font("宋体", 40) '设置字体
Rows = tbl.DataTable.Select("[考试室] = '" & region & "'")
For c As Integer = 0 To ColNames.Length - 1 '
For r As Integer = 0 To Rows.Count -1
rt.Cells(r,c).Text = Rows(r)(ColNames(c))
Next
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Next
doc.preview()
End If
预览时是横向,一打印就成了纵向,请问是什么原因,怎么办?