Dim doc As New Printdoc
Dim rt As prt.RenderTable
rt = New prt.RenderTable
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.right '右
rt.Cells(0,0).SpanCols = 4
rt.Cells(1,0).SpanCols = 4
rt.Cols(0).Width = 28 '设第一列大小
rt.Cols(2).Width = 10
rt.Cells(0,0).Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置字体
rt.CellStyle.Spacing.All = 3 '行与行之间的间隔
rt.rows(2).Style.Borders.left = New prt.LineDef '设表格左边线
rt.rows(3).Style.Borders.left = New prt.LineDef
rt.rows(4).Style.Borders.left = New prt.LineDef
rt.rows(5).Style.Borders.left = New prt.LineDef
rt.rows(6).Style.Borders.left = New prt.LineDef
rt.rows(7).Style.Borders.left = New prt.LineDef
rt.rows(2).Style.Borders.right = New prt.LineDef
rt.rows(3).Style.Borders.right = New prt.LineDef
rt.rows(4).Style.Borders.right = New prt.LineDef
rt.rows(5).Style.Borders.right = New prt.LineDef
rt.rows(6).Style.Borders.right = New prt.LineDef
rt.rows(7).Style.Borders.right = New prt.LineDef
rt.cells(2,1).Style.Borders.left = New prt.LineDef
rt.cells(3,1).Style.Borders.left = New prt.LineDef
rt.cells(4,1).Style.Borders.left = New prt.LineDef
rt.cells(5,1).Style.Borders.left = New prt.LineDef
rt.cells(6,1).Style.Borders.left = New prt.LineDef
rt.cells(7,1).Style.Borders.left = New prt.LineDef
rt.cells(2,2).Style.Borders.left = New prt.LineDef
rt.cells(3,2).Style.Borders.left = New prt.LineDef
rt.cells(4,2).Style.Borders.left = New prt.LineDef
rt.cells(5,2).Style.Borders.left = New prt.LineDef
rt.cells(6,2).Style.Borders.left = New prt.LineDef
rt.cells(7,2).Style.Borders.left = New prt.LineDef
rt.cells(2,3).Style.Borders.left = New prt.LineDef
rt.cells(3,3).Style.Borders.left = New prt.LineDef
rt.cells(4,3).Style.Borders.left = New prt.LineDef
rt.cells(5,3).Style.Borders.left = New prt.LineDef
rt.cells(6,3).Style.Borders.left = New prt.LineDef
rt.cells(7,3).Style.Borders.left = New prt.LineDef
rt.rows(2).Style.Borders.Top = New prt.LineDef
rt.rows(4).Style.Borders.Top = New prt.LineDef
rt.rows(6).Style.Borders.Top = New prt.LineDef
rt.rows(7).Style.Borders.bottom = New prt.LineDef
rt.Cells(0,0).Text = "货物运输及证明"
rt.Cells(1,0).Text = date.today
rt.Cells(2,0).Text = "收货人及其"
rt.Cells(3,0).Text = "纳税识别码"
rt.Cells(4,0).Text = "发货人及其"
rt.Cells(5,0).Text = "纳税识别码"
rt.Cells(6,0).Text = "承运人及其"
rt.Cells(7,0).Text = "纳税识别码"
rt.Cells(2,2).Text = "电"
rt.Cells(3,2).Text = "话"
rt.Cells(4,2).Text = "电"
rt.Cells(5,2).Text = "话"
rt.Cells(6,2).Text = "电"
rt.Cells(7,2).Text = "话"
rt.Cells(2,1).Text = drx("收货_单位")
rt.Cells(4,1).Text = drx("发货_单位")
rt.Cells(6,1).Text = drx("承运单位")
rt.Cells(3,1).Text = drx("收货_税号")
rt.Cells(5,1).Text = drx("发货_税号")
rt.Cells(7,1).Text = drx("承运税号")
rt.Cells(2,3).Text = drx("收货_电话")
rt.Cells(4,3).Text = drx("发货_电话")
rt.Cells(6,3).Text = drx("运承电话")
doc.Body.Children.Add(rt)
rt = New prt.RenderTable
rt.Style.GridLines.All = prt.Linedef.Default '网格线为默认类型
rt.CellStyle.Spacing.All = 2 '行与行之间的间隔
rt.Cols(0).Width = 28
rt.Cols(1).Width = 16
rt.Cols(2).Width = 16
Dim bctbl As dataTable = dataTables("开piao记录")
dim bcrows as list(of datarow)
bcrows = bctbl.select("[打印] = true ")
if bcrows.count < 5 then
for bci as integer = 0 to bcrows.count -1
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(bci+1,1).Text = bcrows(bci)("重量")
rt.Cells(bci+1,2).Text = bcrows(bci)("运价")
rt.Cells(bci+1,3).Text = bcrows(bci)("运费")
rt.Cells(bci+1,4).Text = cumoney(bcrows(bci)("运费"))
for jia as integer = bcrows.count + 1 to 5
rt.Cells(jia,1).Text = "-----"
rt.Cells(jia,2).Text = "-----"
rt.Cells(jia,3).Text = "-----"
rt.Cells(jia,4).Text = "-----"
next
rt.Cells(6,0).Text = "合计"
rt.Cells(6,3).Text = ss
rt.Cells(6,4).Text = cumoney(ss)
next
end if
doc.Body.Children.Add(rt)
doc.Preview()