Dim doc As New PrintDoc() '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As prt.RenderText '定义一个文本对象
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Dim j As Integer = 0 '用于调整偏移
Dim r As Row
Dim tbl As Table = Tables("灭火器表")
For i As Integer = tbl.TopRow To tbl.BottomRow
r = tbl.rows(i)
Dim rep As New prt.RenderEmpty '定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rep ) '加入到报表中
'设置纸张页面
doc.PageSetting.Width = 80 '纸张宽度为100毫米
doc.PageSetting.Height = 24 '纸张高度为120毫米
Doc.PageSetting.LeftMargin = 1 '设置左边距
Doc.PageSetting.RightMargin = 1 '设置右边距
Doc.PageSetting.TopMargin = 1 '设置上边距
Doc.PageSetting.BottomMargin = 1 '设置下边距
'设置表格
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rt.Width = "Auto"
rt.Rows(0).Height = 6.8 +j '设置行高
rt.Cols(0).Width = 23 + j '设置列宽
rt.Rows(1).Height = 6.8 +j '设置行高
rt.Cols(1).Width = 27 + j '设置列宽
rt.Rows(2).Height = 6.9+j '设置行高
rt.Cols(2).Width = 27 + j '设置列宽
rt.Cells(0,0).SpanRows = 3 '向下合并三行
rt.cells(0,1).SpanCols = 2
rt.cells(1,1).SpanCols = 2
rt.cells(2,1).SpanCols = 2
'设置二维码
Bar.Symbology = Barpro.Symbology.QRCode
'Doc.Stacking = prt.StackingRulesEnum.BlockLeftToRight
bar.Code = r("编码")
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
'rg.Style.Spacing.All = 3
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中Spacing
rt.Cells(0,0).RenderObject = rg
rt.Cells(0,1).Text = " 设备编码: " & r("编码")
rt.Cells(1,1).Text = " 放置地点: " & r("放置地点")
rt.Cells(2,1).Text = " 管理员 : " & r("管理员")
Next
Doc.Preview() '预览报表
上面代码,如果选一行打印没问题,框选两行就会出错,错误提示 为:“添加的项目已经有所有者了。”请教问题出在哪里了?