Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Cols.Count = 3 '设置总列数
rt.Cells(0,1).SpanCols = 2
Dim r As Row = Tables("日报").Rows(0)
rt.Cells(0,0).Text = "上日余额"
rt.Cells(0,1).Text = r("余额")
rt.Cells(1,1).SpanCols = 2
rt.Cells(1,0).Text = "本日收入"
rt.Cells(1,1).Text = DataTables("日报").Compute("sum(借方)","借方 > 0 and 摘要 not like '%计%'")
rt.Cells(2,0).Text = "明细"
Dim drs As List(of DataRow) = DataTables("日报").Select("借方 > 0 and 摘要 not like '%计%'")
Dim cnt As Integer = drs.Count
For i As Integer = 0 To cnt - 1
rt.Cells(i+2,1).Text = drs(i)("摘要")
rt.Cells(i+2,2).Text = drs(i)("借方")
Next
cnt = cnt+3
rt.Cells(cnt,1).SpanCols = 2
rt.Cells(cnt,0).Text = "本日支出"
rt.Cells(cnt,1).Text = DataTables("日报").Compute("sum(贷方)","贷方 > 0 and 摘要 not like '%计%'")
cnt = cnt+1
rt.Cells(cnt,0).Text = "明细"
cnt = cnt+1
Doc.Preview() '预览报表