Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
Dim t As Table = Tables("表A")
For Each dr As Row In t.Rows
For i As Integer = 1 To dr("第四列")
Dim rt As New prt.RenderTable() '定义一个表格对象
rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rt.Width = 50 '表格宽度为50mm
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 = dr("第一列")
rt.Cells(1,0).Text = "职务"
rt.Cells(1,1).Text = dr("第三列")
rt.Cells(2,0).Text= "数量"
rt.cells(2,1).Text = dr("第四列")
Dim ra As New prt.RenderArea
ra.Children.Add(rt)
Dim rpar As New prt.RenderParagraph()
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128 '条码规则
Bar.BarRatio = 0.3
Bar.BarHeight = 8
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
bar.Code = dr("第三列")
img = new prt.RenderImage
img.Image = bar.GetImage
Dim rm As New prt.RenderImage '定义一个条码图片对象
rm.Image =bar.getimage '设置条码图片
rm.Width = "Parent.Width" '宽度等于页面宽度
rm.Height = "Auto" '高度由条码图片大小自动决定
rm.Style.ImageAlign.StretchHorz = False '禁止条码图片水平拉伸
rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '水平居中
rm.X=2
rm.y="Prev.Bottom + 2"
ra.Children.Add(rm)
'
doc.Body.Children.Add(rt) '将表格对象加入到报表中
Next
Next
Doc.Preview() '预览报表