Dim doc As New PrintDoc
doc.PageSetting.Width = 220
doc.PageSetting.Height = 50
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
'Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Bar.BarRatio = 0.3
Bar.BarHeight = 18
Bar.QuietZoneWidth = 2
Bar.AddCheckSum = False
Bar.DisplayChecksum = False
Dim rm As prt.RenderEmpty '定一个空对象
For i As Integer = 0 To Tables("表A").rows.Count - 1 Step 4
rm = new prt.RenderEmpty '定义一个新的空对象
rm.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rm) '加入到报表中
For j As Integer = 0 To 3
If i+j < Tables("表A").rows.Count
Dim r As Row = Tables("表A").rows(i + j)
Dim ra As new prt.RenderArea
ra.width = 50
ra.X = j * 50 + 5
ra.Y = 5
ra.Style.Spacing.Right = 2 '设置标签之间的所有和上下间隔为2毫米
ra.Style.Spacing.Bottom = 2
ra.Style.Padding.All = 1 ' 标签内容距离边框为1毫米
ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) '设置边框
Dim txt As new prt.RenderText
txt.text = "XXXXXX公司"
txt.X = 10
txt.y = 5
ra.children.add(txt)
txt = new prt.RenderText
txt.text = r("第一列")
txt.x = 40
txt.y =5
ra.children.add(txt)
bar.Code = r("第二列")
img = new prt.RenderImage
img.Image = bar.GetImage
img.x = 10
img.y = 10
ra.children.add(img)
Doc.Body.Children.Add(ra)
End If
Next
Next
Doc.Preview()