如题..打印代码如下:
Dim rt As Prt.RenderTable
Dim tbl As Table = Tables("领药单")
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetUniqueValues("","住院ID")
doc.Pagesetting.LandScape = false
For Each Region As String In Regions
Dim rs As New prt.RenderText
Dim dr As DataRow = datatables("住院信息").find("[住院ID] = '" & region & "'")
rs.Text = "床位: " & dr("床位") & " 姓名: " & dr("姓名")
rs.Style.FontSize = 10
rs.Style.FontBold = True
doc.Body.Children.Add(rs)
rt = New prt.RenderTable
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.GridLines.Top = New prt.LineDef(0.4,Color.Black)
rt.Style.Spacing.Bottom = 5
rt.CellStyle.Spacing.All = 1
rt.Style.Font = tbl.Font
rt.Cols(1).Width = 40
rt.Cols(2).Width = 30
Rows = tbl.Datatable.Select("[住院ID] = '" & Region & "'")
Dim cc as integer = tbl.Cols.Count
rt.Cells(0,cc).Text = "金额"
For c As integer = 0 To tbl.Cols.Count - 1
rt.Cells(0,c).Text = tbl.Cols(c).Name
For r As integer = 0 To Rows.Count -1
rt.Cells(r + 1, cc).Text = tbl(r,5)*tbl(r,6)
rt.Cells(r + 1, c).Text = rows(r)(tbl.Cols(c).Name)
Next
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
rt.Style.Gridlines.Horz = New prt.Linedef(0.3,Color.LightGray)
doc.Body.Children.Add(rt)
Next
原表有一列隐藏列......执行上述代码时,隐藏列也给我打出来了....记得以前是不会的..
此主题相关图片如下:001.jpg
[此贴子已经被作者于2009-2-20 21:21:59编辑过]