Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("出库单")
rx = New prt.RenderText
rx.Style.FontSize = 14
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
rx.Text = "XXX公司出货订单"
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rx)
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 3
rx.Text = "出库单号:" & tbl.Current("出库单号")
rx.style.TextAlignHorz = prt.AlignHorzEnum.Left
Doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Style.Spacing.Bottom = 3
rt.Cols.Count = 2
rt.Style.FontBold = True
rt.Cells(0,0).Text = "领用部门:" & tbl.Current("领用部门") & " 出库日期:" & tbl.Current("出库日期")
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rt.Cells(0,1).Text = "领料人:" & tbl.Current("领料人")
rt.Cells(0,1).Style.TextAlignHorz = prt.AlignHorzEnum.Right
Doc.Body.Children.Add(rt)
rt = New prt.RenderTable
rt.Style.Spacing.Bottom = 3
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
rt.CellStyle.Spacing.All = 1
rt.Cols.Count = 6
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.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
With Tables("出库单.出库明细")
For r As Integer = 0 To 9
If r < .Rows.Count Then
rt.Cells(r+1,0).Text = .rows(r)("物料代码")
rt.Cells(r+1,1).Text = .rows(r)("物料名称")
rt.Cells(r+1,2).Text = .rows(r)("规格型号")
rt.Cells(r+1,3).Text = .rows(r)("单位")
rt.Cells(r+1,4).Text = .rows(r)("数量")
rt.Cells(r+1,5).Text = .rows(r)("备注")
Else
rt.Cells(r+1, 0).Text = " "
End If
Next
End With
doc.Body.Children.Add(rt)
rt = New prt.RenderTable
rt.Style.Spacing.Bottom = 3
rt.Cols.Count = 2
rt.Style.FontBold = True
rt.Cells(0,0).Text = "库管员:" & tbl.Current("库管员")
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rt.Cells(0,1).Text = "合计:" & Tables("出库单.出库明细").Compute("Sum(数量)")
rt.Cells(0,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
Doc.Body.Children.Add(rt)
doc.Preview
希望实现自动控制每页9行.(自动换页)
[此贴子已经被作者于2013-10-30 12:18:42编辑过]