或者这样写
Dim g As New GroupTableBuilder("统计表", DataTables("统计表"))
g.Groups.AddDef("区域")
g.Groups.AddDef("大区")
g.Groups.AddDef("类别")
g.Groups.AddDef("产品名称")
g.Totals.AddDef("件数")
g.Totals.AddDef("销售金额")
g.VerticalTotal = True
g.GrandProportion = True
forms("窗口1").open
Tables("窗口1_Table1").DataSource = g.BuildDataSource()
Dim t As Table = Tables("窗口1_Table1")
Dim g1 As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = True
t.SpillNode = True
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Sum
g1.GroupOn = "大区"
g1.TotalOn = "件数,销售金额"
g1.Caption = "{0} 小计"
t.SubtotalGroups.Add(g1)
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Sum
g1.GroupOn = "区域"
g1.TotalOn = "件数,销售金额"
g1.Caption = "{0} 小计"
t.SubtotalGroups.Add(g1)
Tables("窗口1_table1").Font = New Font("宋体",10,FontStyle.Bold)
Tables("窗口1_table1").Sort = "件数 DESC"