Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 100
doc.PageSetting.Height = 76
Doc.PageSetting.LeftMargin = 5
Doc.PageSetting.RightMargin = 1
Doc.PageSetting.TopMargin = 5
Doc.PageSetting.BottomMargin = 2
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
Dim n As Integer = CurrentTable.Rows.Count - 1
For i As Integer = 1 To n
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim ra As New prt.RenderArea
Dim rt2 As New prt.RenderTable() '定义一个表格对象
Dim ra2 As New prt.RenderArea
Dim r As Row = CurrentTable.Rows(i)
Dim s1 As Integer = Val(r("每箱数量"))
Dim s2 As Integer = Val(r("整数箱数"))
Dim s3 As Integer = Val(r("尾数数量"))
'指定行数?列数?列宽?行高
rt.Rows.Count = 7 '设置总行数
rt.Cols.Count = 2 '设置总列数
rt.Height = 71 '设置表格的总高度毫米
rt.Width = 96 '表格宽度为50mm'
'设置行高
rt.Rows(0).Height = 6
rt.Rows(1).Height = 8
rt.Rows(2).Height = 15
rt.Rows(3).Height = 10
rt.Rows(4).Height = 8
' rt.Rows(5).Height = 14
rt.Rows(6).Height = 9
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
'设置列宽
rt.Cols(0).Width = 15
rt.Cols(1).Width = 79
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Left '水平居左排列
'设置合并单元格
rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
'设置各单元格内容
rt.cells(0,0).Text = "NAME:"
rt.cells(0,0).Style.Font = new font("Arial", 12)
rt.Cells(0,1).Text = "广州市柏森塑料制品有限公司 - 062006"
rt.cells(0,1).Style.Font = new font("Arial", 12)
rt.Cells(2,0).Text= "ITEM:"
rt.cells(2,0).Style.Font = new font("Arial", 12)
rt.cells(3,0).Text = "DESC:"
rt.cells(3,0).Style.Font = new font("Arial", 12)
rt.cells(4,0).Text = "QTY:"
rt.cells(4,0).Style.Font = new font("Arial", 12)
rt.cells(6,0).Text = "DATE:"
rt.cells(6,0).Style.Font = new font("Arial", 12)
rt.Cells(2,1).Text = r("物料编号")
rt.cells(2,1).Style.Font = new font("Arial", 35)
rt.Cells(3,1).Text = r("物料名称")
rt.cells(3,1).Style.Font = new font("Arial", 12)
rt.cells(4,1).Text = r("出库数量") * (-1)
rt.cells(4,1).Style.Font = new font("Arial", 12)
rt.cells(6,1).Text = r("出入库日期")
rt.cells(6,1).Style.Font = new font("Arial", 12)
Doc.Body.Children.Add(rt) '将表格对象加入到报表中
'-------------条形码-供应商代号
ra = rt.cells(1,1).area
Dim rg As New prt.RenderGraphics
Dim Bar1 As New BarCodeBuilder
Bar1.Symbology = Barpro.Symbology.Code128
bar1.Code = "062006"
rg = new prt.RenderGraphics
Bar1.BarHeight = 8
bar1.DrawOnCanvas(rg.Graphics,0,0,1.2)
ra.Children.Add(rg)
'-------------条形码-物料编号
ra2 = rt2.cells(5,1).area
Dim rg2 As New prt.RenderGraphics
Dim Bar2 As New BarCodeBuilder
Bar2.Symbology = Barpro.Symbology.Code128
bar2.Code = r("条形码")
rg2 = new prt.RenderGraphics
Bar2.BarHeight = 8
bar2.DrawOnCanvas(rg2.Graphics,0,0,1)
ra2.Children.Add(rg2)
Next
Doc.Preview() '预览报表
我的上述代码,第一个条形码(供应商代号)可以出来,为什么见不到第二个条形码(物料代号)出来呢?谢谢。