Dim t As Table = Tables("目标成本")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "三级科目"
g.TotalOn = "目标成本"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "二级科目"
g.TotalOn = "目标成本"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "一级科目"
g.TotalOn = "目标成本"
g.Caption = "{0} 合计"
t.SubtotalGroups.Add(g)
t.Subtotal()
基本和你要的差不多,你再改下