加上红色部分就开始报错,请问如何解决?谢谢!
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:Excel报表,BeforeBuild
详细错误信息:
已添加了具有相同键的项。
代码如下
Dim g As New GroupTableBuilder("统计表1", DataTables("打印"))
g.Groups.AddDef("通知单号", "", "通知单号")
g.Groups.AddDef("订单单号", "", "订单单号")
g.Groups.AddDef("卡号", "", "卡号")
g.Groups.AddDef("客户", "", "客户")
g.Totals.AddDef("TBSTT", AggregateEnum.Count)
g.Totals.AddDef("临时1", AggregateEnum.Count, "页数")
g.Build()
MainTable = Tables("统计表1")
Dim r As Double
For Each dr As DataRow In DataTables("统计表1").DataRows
dr("页数") = math.Ceiling(dr("TBSTT") / 5)
Next
If DataTables.Contains("统计表1") Then
Dim gg As New GroupTableBuilder("统计表2", DataTables("统计表1"))
gg.Groups.AddDef("通知单号")
gg.Totals.AddDef("页数")
gg.Build()
MainTable = Tables("统计表2")
End If
vars("序号") = 0
vars("总页") = 0
Select Case e.Book.TempLate
Case "print_notice"
e.Book.Marks.Add("页号", "")
e.Book.Marks.Add("pg", 0)
End Select