以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  不显示生成的表  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194553)

--  作者:g1j2h3
--  发布时间:2024/12/20 16:02:00
--  不显示生成的表
不想显示生成的表,下边的代码如何写
......
Tables("统计汇总_table1").DataSource = bd1.BuildDataSource()
Dim tbl As Table = Tables("统计汇总_table1")
Dim hdr As Integer = tbl.HeaderRows \'获得表头的层数
......

--  作者:有点蓝
--  发布时间:2024/12/20 16:34:00
--  
完整代码发上来
--  作者:g1j2h3
--  发布时间:2024/12/20 16:39:00
--  
Dim bd1 As New CrossTableBuilder("统计表1", jd)
bd1.HGroups.AddDef("产品名称") \'添加客户列用于水平分组
bd1.HGroups.AddDef("规格型号") \'添加客户列用于水平分组
bd1.HGroups.AddDef("单位") \'添加客户列用于水平分组
bd1.VGroups.AddDef("接单日期", DateGroupEnum.Year, "{0}年")
bd1.VGroups.AddDef("接单日期", "{0}月") \'添加日期列用于垂直分组,按月分组
bd1.VGroups.AddDef("客户来源", "{0}")
bd1.Totals.AddDef("销售数量", "接单")
bd1.Totals.AddDef("已发货数量", "发货")
Tables("统计汇总_table1").DataSource = bd1.BuildDataSource()

Dim tbl As Table = Tables("统计汇总_table1")
Dim hdr As Integer = tbl.HeaderRows \'获得表头的层数
Dim szs() As Integer = {250, 120, 50}
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() \'定义新样式
Dim fnt As New Font("宋", 11)
Style.ForeColor = Color.black \'设置样式的字体颜色
Style.AlignHorz = XLS.AlignHorzEnum.Center
Style.AlignVert = XLS.AlignVertEnum.Center
tbl.CreateSheetHeader(Sheet, 1, 0, False) \'生成表头
Sheet.DefaultRowHeight = 35
Sheet.GridColor = Color.blue
For f As Integer = 0 To 2
    Sheet.Cols(f).Width = szs(f) \'指定列宽
Next

For s As Integer = 3 To tbl.Cols.Count - 1
    Sheet.Cols(s).Width = 50 \'指定列宽
Next

For c As Integer = 0 To tbl.Cols.Count - 1
    For r As Integer = 1 To tbl.Rows.Count - 1
        sheet(r + hdr, c).value = tbl(r, c)
        Sheet.MergeCell(0, 0, 1, c + 1)
        Sheet(0, 0).Value = "接单送货汇总表"
        Sheet(r, c).Style = Style
        Sheet(r, c).Style.Font = fnt
    Next
Next

Dim St2 As XLS.Style = Book.NewStyle
St2.Font = New Font("微软雅黑", 15, FontStyle.Bold)
St2.AlignHorz = XLS.AlignHorzEnum.Center
St2.AlignVert = XLS.AlignVertEnum.Center
Sheet.Rows(tbl.Rows("0").Index).Style = st2

Book.Save("d:\\data\\接单送货汇总表.xls")
Dim Proc As New Process
Proc.File = "d:\\data\\接单送货汇总表.xls"
Proc.Start()

--  作者:有点蓝
--  发布时间:2024/12/20 16:55:00
--  
把table1这个控件隐藏起来