Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
rx = New prt.RenderText
rx.Style.FontSize = 14
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 3
rx.Style.TextAlignVert = prt.AlignVertEnum.Center
rx.Style.WordWrap = True
rx.Text = "常德市鼎城区疾病预防控制中心一类疫苗调拨暨运输记录" ' & Tables("类别").Current("类别名称")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.GridLines.All = New prt.Linedef
rt.Rows.Count = 18
rt.Cols(0).Width = 13
rt.Cols(1).Width = 17
rt.Cols(2).Width = 12
rt.Cols(3).Width = 7
rt.Cols(4).Width = 6
rt.Cols(5).Width = 8
rt.Cols(6).Width = 10
rt.Cols(7).Width = 5
rt.Cols(8).Width = 7
rt.Cols(9).Width = 7
rt.Cols(10).Width = 8
rt.Cells(1,0).Text = "药品名称"
rt.Cells(1,1).Text = "药品生产厂家"
rt.Cells(1,2).Text = "批准文号"
rt.Cells(1,3).Text = "规格"
rt.Cells(1,4).Text = "剂型"
rt.Cells(1,5).Text = "药品批号"
rt.Cells(1,6).Text = "药品有效期"
rt.Cells(1,7).Text = "单位"
rt.Cells(1,8).Text = "单价"
rt.Cells(1,9).Text = "数量"
rt.Cells(1,10).Text = "金额"
rt.rows(0).Style.Borders.Top = New prt.LineDef(0.5,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.LightGray)
Dim r1 As Row = Tables("一类疫苗入库单").Current
rt.Cells(0,0).Text = "供货单位:" & r1("供货单位")
rt.Cells(0,0).SpanCols = 3
rt.Cells(0,3).Text = "入库单编号:" & r1("入库单编号")
rt.Cells(0,3).SpanCols = 4
rt.Cells(0,7).Text = "日期:" & r1("日期")
rt.Cells(0,7).SpanCols = 4
With Tables("一类疫苗入库单.一类疫苗入库表")
For r As Integer = 2 To .Rows.Count - 1 '遍历关联表每一行
rt.Cells(r,0).Text = .rows(r)("药品名称")
rt.Cells(r,1).Text = .rows(r)("药品生产厂家")
rt.Cells(r,2).Text = .rows(r)("批准文号")
rt.Cells(r,3).Text = .rows(r)("规格")
rt.Cells(r,4).Text = .rows(r)("剂型")
rt.Cells(r,5).Text = "药品批号"
rt.Cells(r,6).Text = "药品有效期"
rt.Cells(r,7).Text = "单位"
rt.Cells(r,8).Text = "单价"
rt.Cells(r,9).Text = "数量"
rt.Cells(r,10).Text = "金额"
Next
End With
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 1
' rx.Text = "产品数目: " & Tables("类别.产品").Rows.Count
' rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
doc.PageSetting.Width = 231.1 '纸张宽度为100毫米
doc.PageSetting.Height = 139.7 '纸张高度为120毫米
doc.AutoRotate = False
doc.PageSetting.BottomMargin = 5
doc.PageSetting.Landscape = True
doc.PageSetting.LeftMargin = 12.7
doc.PageSetting.PaperKind = 11
doc.PageSetting.RightMargin = 12.7
doc.PageSetting.TopMargin = 0.8
doc.Body.Children.Add(rt)
doc.Preview
[此贴子已经被作者于2018/6/16 9:48:36编辑过]