以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]导出临时表问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=184875) |
-- 作者:mengxxaa -- 发布时间:2023/1/12 10:34:00 -- [求助]导出临时表问题 代码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() 问题:生成的统计表是带有汇总结果的,但是导出来时,却没有汇总结果。怎么修改代码,让汇总结果也能导出来。 |
-- 作者:有点蓝 -- 发布时间:2023/1/12 10:36:00 -- 参考:http://www.foxtable.com/webhelp/topics/1594.htm,看【考虑分组行】后面的用法,遍历的时候加上true参数 |