Foxtable(狐表)用户栏目专家坐堂 → [求助]导出临时表问题


  共有3769人关注过本帖树形打印复制链接

主题:[求助]导出临时表问题

帅哥哟,离线,有人找我吗?
mengxxaa
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:98 积分:837 威望:0 精华:0 注册:2022/10/10 15:34:00
[求助]导出临时表问题  发帖心情 Post By: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()

问题:生成的统计表是带有汇总结果的,但是导出来时,却没有汇总结果。怎么修改代码,让汇总结果也能导出来。


 回到顶部