以下是引用bad在2011-9-3 23:39:00的发言:
此主题相关图片如下:afd.jpg
上面的公式复制到代码编辑器,点确定后发生上述错误
这是你纸上谈兵的结果!正确的:
Dim s As String
Dim t As Table = Tables("统计汇总")
Dim g As New CrossTableBuilder("统计汇总", DataTables("绩效计划表"))
g.Caption = "统计汇总"
g.HGroups.AddDef("年度")
g.HGroups.AddDef("季度")
g.VGroups.AddDef("分管领导")
g.Totals.AddDef("权重", "权重")
g.Totals.AddDef("实际得分", "实际得分")
g.Decimals = 2
g.Build()
For Each c As col In t.cols
If c.name <> "年度" AndAlso c.name <> "季度" Then
s+ = "," & c.name
End If
Next
Dim g1 As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Average
g1.GroupOn = "年度"
g1.TotalOn = s.trim(",")
g1.Caption = "{0}年 平均"
t.SubtotalGroups.Add(g1)
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Average
g1.GroupOn = "*"
g1.TotalOn =s.trim(",")
g.Caption = "总平均"
t.SubtotalGroups.Add(g1)
t.Subtotal()
MainTable = t