Dim g1 As New CrossTableBuilder("统计表1", DataTables("订单"))
g1.HGroups.AddDef("客户")
g1.HGroups.AddDef("产品")
g1.VGroups.AddDef("雇员")
g1.Totals.AddDef("金额")
g1.VerticalTotal = True
g1.HorizontalTotal = True
g1.OrderByTotal = e.Form.Controls("CheckBox1").Checked
g1.Build()
Tables("统计表1").AutoSizeCols(10)
MainTable = Tables("统计表1")
Forms("返回").OpenTo("统计表1")
Forms("返回").Controls("TextBox1").Value = "提示: 不同客户订购各种产品的数量和金额。"
MainTable.Focus()
'''
Dim str As String = "" For Each c As Col In Tables("统计表1").cols If c.Name Like "*金额*" Then str &= c.name & "," End If Next |
Dim t As Table = Tables("统计表1")
Dim g As Subtotalgroup
t.StopRedraw()
t.SubtotalGroups.Clear()
t.GroupAboveData = True
t.TreeVisible = True
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "产品"
g.TotalOn = str.trim(",")
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = str.trim(",")
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
t.Grid.Tree.Show(1)
t.Grid.Tree.Show(0)
t.Grid.Rows(2).Node.Expanded = True
t.Grid.Rows(3).Node.Expanded = True
t.ResumeRedraw()
以上是原码,大红袍,我把你写的那行代码表述进去
[此贴子已经被作者于2015/8/11 17:14:31编辑过]