Dim doc As New PrintDoc() '定义一个报表
doc.PageSetting.Width = 58 '纸张宽度为100毫米
' doc.PageSetting.Height = 120 '纸张高度为120毫米
Dim tbl As Table = Tables("表A")
Dim rw As Row
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim ra As New prt.RenderArea '定义一个容器
Doc.Body.ChildRen.Add(ra)
rt.Cols(0).Width = 58
rt.Cols(1).Width = 58
rx.text = "缴费"
rx.Style.Font = New Font("宋体", 9 , FontStyle.Bold) '设置文本对象的
ra.Children.Add(rx) '加入到容器中
For i As Integer = tbl.TopPosition To tbl.BottomPosition
rw = tbl.Rows(i)
rt.rows(rt.Rows.Count).Height = 12
Dim j As Integer = (i-tbl.TopRow) * 3
rt.Cells(0+j,0).Text= "姓名"
rt.Cells(0+j,1).Text = rw("第一列")
rt.rows(0+j).Height = 12
rt.Cells(1+j,0).Text= "卡号:"
rt.Cells(1+j,1).Text = rw("第二列")
rt.rows(1+j).Height = 12
rt.Cells(2+j,0).Text= "金额:"
rt.Cells(2+j,1).Text = rw("第三列")
'将容器加入到报表中
Next
ra.Children.Add(rt) '加入到容器中
Doc.Preview()