我按照帮助文件的要求,将build方法设定为true,不能打印出多层表头,g.caption的设置也没起作用,请帮指教一下,谢谢!
此主题相关图片如下:表头.jpg
代码:
Dim dt As DataTable
Dim g As New CrossTableBuilder("统计表1", DataTables("派工单明细表"))
g.HGroups.AddDef("出工人员姓名")
g.HGroups.AddDef("村民组")
g.VGroups.AddDef("工程名称")
g.Totals.AddDef("工时", "工时")
g.Totals.AddDef("工价", "工价")
g.OrderByTotal = True
g.HorizontalTotal = True
g.VerticalTotal = True
g.Decimals = 2
g.Subtotal = True
g.Caption ="江安镇徐柴村公用工统计表"
dt = g.Build(True)
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
For Each Col As DataCol In Dt.DataCols
rt.Cells(0,Count).Text = Col.Name
For r As Integer = 0 To dt.DataRows.Count - 1
rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
Next
Count = Count + 1
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()