Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.PaperKind = 9 '纸张类型改为A4
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
Dim ra As New prt.RenderArea '定义一个容器
ra.Style.Spacing.all = 0 '设置右间间隔毫米
ra.Style.BackColor = Color.black '背景颜色'
ra.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置容器中对象的排列方式
Dim ks As Integer = 1
Dim js As Integer = 44
For i As Integer = ks To js
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
bar.Code = "TE" & i
Bar.BarHeight = 10
Bar.AddCheckSum = False
Bar.DisplayStartStopChar = False
Bar.TopMargin = 0.5
Bar.BottomMargin = 0.3
Bar.Font = New Font("微软雅黑",10.5)
Bar.TextFont = New Font("微软雅黑",10.5)
bar.text = "测试"
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
Dim rt As New prt.RenderTable() '定义一个表格对象
rt.CellStyle.Spacing.All = 1
rt.Style.GridLines.All = New prt.Linedef(Color.DarkGray) '将表格的颜色设为深灰色
rt.Style.BackColor = Color.yellow
rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
rt.Style.Spacing.All = 2.5 '内容和网格线的距离为1
rt.Width = 51 '表格宽度为50mm
rt.Height = 26.6 '设置表格的高度
rt.Cells(0,0).RenderObject = rg
rt.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
ra.Children.Add(rt) '将文本对象加入到容器ra中
Next
doc.Body.Children.Add(ra) '将容器ra加入到报表
Doc.Preview() '预览报表