Dim g As New CrossTableBuilder("统计表1", DataTables("aa"))
Dim dt As DataTable
g.HGroups.AddDef("客户产品号")
g.VGroups.AddDef("下单日期", "{0}月")
g.Totals.AddDef("订货数量", "订货数量")
g.Totals.AddDef("未税总价", "未税总价")
g.Decimals = 2
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
If count > 0 Then
If Col.Caption.StartsWith(count) = False Then
msgbox(2)
For i As Integer = count To Col.Caption.Split("月")(0) - 1
rt.Cells(0,Count).Text = i & "月_订货数量"
For r As Integer = 0 To dt.DataRows.Count - 1
rt.Cells(r +1,Count).Text = ""
Next
count += 1
rt.Cells(0,Count).Text = i & "月_未税总价"
For r As Integer = 0 To dt.DataRows.Count - 1
rt.Cells(r +1,Count).Text = ""
Next
count += 1
Next
End If
End If
rt.Cells(0,Count).Text = Col.Caption
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()