代码1(生成统计表):Dim b As New CrossTableBuilder("统计表1", DataTables("so_det"))
b.HGroups.AddDef("so_date", DateGroupEnum.Year, "年")
b.HGroups.AddDef("so_date", DateGroupEnum.Month, "月")
b.VGroups.AddDef("so_yw")
b.Totals.AddDef("so_oder_qty", "数量")
b.Totals.AddDef("so_sub", "金额")
b.VerticalTotal = True
b.HorizontalTotal = True
b.Subtotal = True
b.FromServer = True
b.Build()
Tables("统计表1").AutoSizeCols()
Tables("统计表1").Cols("月").TextAlign = TextAlignEnum.Right
MainTable = Tables("统计表1")
代码2(导出统计表):
Dim tbl As Table = Tables("统计表1")
Dim hdr As Integer = tbl.HeaderRows
Dim cnt As Integer
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
tbl.CreateSheetHeader(Sheet)
For c As Integer = 0 To tbl.Cols.Count - 1
If tbl.Cols(c).Visible Then
For r As Integer = 0 To tbl.Rows.Count - 1
sheet(r + hdr, cnt).value = tbl(r, c)
Next
cnt = cnt + 1
End If
Next
Book.Save("c:\reports\test.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()
问题:生成的统计表是带有汇总结果的,但是导出来时,却没有汇总结果。怎么修改代码,让汇总结果也能导出来。