Dim tbl As Table = Tables("合同分表_table1")
For i As Integer = tbl.TopRow To tbl.BottomRow
Dim Rows As List(Of DataRow)
Dim Doc As new PrintDoc()
Dim rt As new prt.rendertable
Dim rx As new prt.RenderText
rx.style.Font = new font("宋体",16)
rx.style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Style.Spacing.Bottom = 3
rx.text = "银行交易明细"
Doc.body.Children.Add(rx)
rt.rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '唯独第一列内容居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt.RowGroups(0,1).Style.BackColor = Color.LightGray '第三第四行的颜色设为灰色
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All '前四行作为表头
rt.style.Font = new font("宋体",9)
rt.style.GridLines.all = new prt.LineDef
rt.Cols(1).Width = 32
rt.Cols(2).Width = 32
rt.Cols(8).Width = 32
rt.Cols(10).Width = 12
rt.Cols(11).Width = 32
rt.cells(0,0).text="交易日期"
rt.cells(0,1).text="银行账号"
rt.cells(0,2).text="银行卡号"
rt.cells(0,3).text="交易户名"
rt.cells(0,4).text="交易内容"
rt.cells(0,5).text="借方金额"
rt.cells(0,6).text="借方金额"
rt.cells(0,7).text="余额"
rt.cells(0,8).text="对方账号"
rt.cells(0,9).text="对方户名"
rt.cells(0,10).text="地点号"
rt.cells(0,11).text="交易机构"
Dim t As Table = Tables("合同分表_table3")
Rows =DataTables("查证明细").Select("合同编号= '" & tbl.Rows(i)("合同编号") & "'")
msgbox(rows.Count-1)
For n As Integer = 0 To rows.Count-1
rt.Rows(n).Height = 7
rt.cells(n+1,0).text= rows(n)("交易日期")
rt.cells(n+1,1).text= rows(n)("银行账号")
rt.cells(n+1,2).text= rows(n)("银行卡号")
rt.cells(n+1,3).text= rows(n)("交易户名")
rt.cells(n+1,4).text= rows(n)("交易内容")
If rows(n)("借方金额") = 0 Then
rt.cells(n+1,5).text= Nothing
Else
rt.cells(n+1,5).text= rows(n)("借方金额")
End If
If t.rows(n)("贷方金额") = 0 Then
rt.cells(n+1,6).text= Nothing
Else
rt.cells(n+1,6).text= rows(n)("贷方金额")
End If
rt.cells(n+1,7).text= rows(n)("余额")
rt.cells(n+1,8).text= rows(n)("对方账号")
rt.cells(n+1,9).text= rows(n)("对方户名")
rt.cells(n+1,10).text= rows(n)("地点号")
rt.cells(n+1,11).text= rows(n)("交易机构")
rt.cells(n+1,5).Style.TextAlignHorz = prt.AlignHorzEnum.Right
rt.cells(n+1,6).Style.TextAlignHorz = prt.AlignHorzEnum.Right
rt.cells(n+1,7).Style.TextAlignHorz = prt.AlignHorzEnum.Right
Next
rt.Rows(rows.Count).Height = 7
Doc.body.Children.Add(rt)
Dim rx1 As New prt.RenderTable
rx1.Cells(0,0).Text = Date.Today
rx1.Cells(0,1).Text = "银行交易明细"
rx1.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx1.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx1.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx1.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
rx1.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx1.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx1.Style.FontSize = 9 '字体大小为8磅
Doc.PageHeader = rx1 '作为页眉使用
Doc.PageSetting.LeftMargin = 10 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 10 '设置上边距
Doc.PageSetting.BottomMargin = 10 '设置下边距
doc.PageSetting.Landscape = True
Doc.preview()
Next