参考代码
Dim g As New CrossTableBuilder("统计表1", DataTables("表C"))
g.HGroups.AddDef("日期",DateGroupEnum.none)
g.VGroups.AddDef("类型")
g.Totals.AddDef("数量")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
Dim t As Table = Tables("统计表1")
For i As Integer = 0 To t.cols.count-1
If t.cols(i).name.contains("数量_") Then
Dim x As Integer = t.cols(i).name.split("_")(1)
Dim dc = t.DataTable.DataCols.Add("添加_" & x, Gettype(Double), "isnull(数量_" & x & ",0)-isnull(数量_1,0)", "小计")
t.cols(dc.name).Move(i+1)
End If
Next
For Each r As Row In t.rows
next
MainTable = t