Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 100 '纸张宽度为100毫米
doc.PageSetting.Height = 70 '纸张高度为90毫米
Doc.PageSetting.LeftMargin = 1 '设置左边距
Doc.PageSetting.RightMargin = 1 '设置右边距
Doc.PageSetting.TopMargin = 1 '设置上边距
Doc.PageSetting.BottomMargin = 1 '设置下边距
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
For i As Integer = 1 To 4
Dim rt As New prt.RenderTable() '定义一个表格对象
rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rt.Width = 48 '表格宽度为50mm
rt.Height = 33
rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
'rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
rt.Cols(0).Width = 20
rt.cells(0,0).Text = "姓名"
rt.Cells(0,1).Text = "黄财德"
rt.Cells(1,0).Text = "职务"
rt.Cells(1,1).Text = "总经理"
rt.Cells(2,0).Text= "工号"
rt.cells(2,1).Text = "44081996008"
doc.Body.Children.Add(rt) '将表格对象加入到报表中
Next
Dim rt2 As prt.RenderText
Dim ra As New prt.RenderArea
'设置水印
rt2 = New prt.RenderText '设置文本对象的内容
rt2.Text = "第一张" '设置文本内容
rt2.Width = "40" '宽度等于页面宽度
rt2.Height = "30" '高度等于页面高度
rt2.X = 4
rt2.Y = 2
rt2.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
rt2.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
rt2.Style.FontSize = 36 '字体大小为8磅
rt2.Style.TextColor = Color.Gray '文本颜色为灰色
ra.Children.Add(rt2)
rt2 = New prt.RenderText '设置文本对象的内容
rt2.Text = "①" '设置文本内容
rt2.Width = "5" '宽度等于页面宽度
rt2.Height = "5" '高度等于页面高度①
rt2.X = 40
rt2.Y = 26
rt2.Style.TextColor = Color.red
ra.Children.Add(rt2)
rt2= New prt.RenderText '设置文本对象的内容
rt2.Text = "第二张" '设置文本内容
rt2.Width = "40" '宽度等于页面宽度
rt2.Height = "30" '高度等于页面高度
rt2.X = 54
rt2.Y = 2
rt2.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
rt2.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
rt2.Style.FontSize = 36 '字体大小为8磅
rt2.Style.TextColor = Color.Gray '文本颜色为灰色
ra.Children.Add(rt2)
rt2 = New prt.RenderText '设置文本对象的内容
rt2.Text = "②" '设置文本内容
rt2.Width = "5" '宽度等于页面宽度
rt2.Height = "5" '高度等于页面高度①
rt2.X = 90
rt2.Y = 26
rt2.Style.TextColor = Color.red
ra.Children.Add(rt2)
Doc.WaterMark = ra '作为水印使用
Doc.Preview() '预览报表