Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 210 '纸张宽度为100毫米
doc.PageSetting.Height = 297 '纸张高度为120毫米
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
With Tables("席签打印_table1")
For Each Currow As Row In .GetCheckedRows
Dim rep As New prt.RenderEmpty '定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rep) '加入到报表中
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As prt.RenderText '定义一个文本对象
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Rows(0).Height = 297
rt.Cols(0).Width= 99
rt.Cols(1).Width= 99
rt.Cols(2).Width= 99
Dim ra As New prt.RenderArea '背景设置
ra.Width = "Parent.Width" '宽度等于页面宽度
ra.Height = "Parent.Height" '高度等于页面高度
ra.Style.BackColor = Color.Pink
rx = new prt.RenderText
ra = rt.Cells(0,0).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
ra.Children.Add(rx)
rx = new prt.RenderText
ra = rt.Cells(0,1).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
ra.Children.Add(rx)
rx = new prt.RenderText
ra = rt.Cells(0,2).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
ra.Children.Add(rx)
doc.body.Children.Add(rt)
Next
End With
_MyDoc = Doc
_MyRDL.Document = _MyDoc
Dim p As WinForm.Panel = e.Form.controls("Panel1")
If p.basecontrol.controls.count = 0 Then
_MyRDL.Dock = 5
p.BaseControl.Controls.Add(_MyRDL)
_MyRDL.Toolbars.File.Visible = False
End If
_MyDoc.Generate() '这句替代 doc.Preview() '预览