Dim doc As New PrintDoc '定义一个报表
Doc.Columns.Add() '增加三栏
Doc.Columns.Add() '增加三栏
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.BarWidth = 0.28
doc.Stacking = prt.StackingRulesEnum.BlockTopToBottom '设置排列方式
Dim rg As New prt.RenderGraphics
Dim rt As prt.RenderText
doc.PageSetting.Width = 62 '纸张宽度为100毫米
doc.PageSetting.Height = 86
Doc.Columns(0).Spacing = 40 '栏间距2毫米
Doc.PageSetting.LeftMargin = 1
Doc.PageSetting.TopMargin = 1.5
'doc.PageSetting.Landscape = True
For Each r As Row In Tables("进货单明细").Rows
For i As Integer = 1 To r("SL")
Dim ra As New prt.RenderArea
ra.Width = 60 '宽度等于分栏宽度
ra.Height = 40 '高度24毫米
ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) '设置边框
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never '禁止水平分割
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止垂直分割
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
rt = New prt.RenderText
rt.Text = r("SPMC")
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("宋体", 24, FontStyle.Bold)
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = r("DJ") & "元"
rt.Y = "Prev.Bottom"
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("宋体", 32, FontStyle.Bold)
ra.Children.Add(rt)
bar.Code = r("SKU")
bar.BarHeight = 7
Bar.Font = New Font("宋体", 14, FontStyle.Bold)
rg = New prt.RenderGraphics
'rg.X = 8
rg.Y = "Prev.Bottom"
Bar.QuietZoneWidth = 10
bar.DrawOnCanvas(rg.Graphics, 0, 0, 1)
ra.Children.Add(rg)
rt = New prt.RenderText
rt.Text = r("GG1MC")
rt.X = 14.5
rt.Y = 33
rt.Style.Font = New Font("宋体", 12, FontStyle.Bold)
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = r("GG2MC")
rt.X = 40.5
rt.Y = 33
rt.Style.Font = New Font("宋体", 12, FontStyle.Bold)
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = r("ZJF")
rt.X = 52
rt.Y = 8
rt.Style.Font = New Font("宋体", 14, FontStyle.Bold)
rt.Style.TextAngle = -90
ra.Children.Add(rt) '添加到容器中
Next
Next
Doc.Preview() '预览报表