Dim doc As New PrintDoc
Dim tb As Table = Tables("订单")
Dim prs As Integer = 20 '每页20行
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
Dim rt As New prt.RenderTable
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 0.5
For c As Integer = 0 To tb.Cols.Count - 1
rt.Cells(0,c).Text = tb.Cols(c).Name
Next
For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
For c As Integer = 0 To tb.Cols.Count - 1
rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
Next
Next
If p = math.Ceiling(tb.Rows.Count / prs) - 1 '如果是最后一页
Dim i = rt.Rows.Count
rt.cells(i,0).SpanCols = tb.Cols.count
rt.cells(i,0).text = "以下空白..."
rt.Rows(i).Height = new C1.C1Preview.Unit(CStr(10 * (( p + 1) * prs - 1 - tb.Rows.count)))
Else
rt.BreakAfter = prt.BreakEnum.Page '否则换页
End If
doc.Body.Children.Add(rt)
Next
doc.Preview()