设置成汇总模式,然后用SaveExcel方法。
Dim t As Table = Tables("表A")Dim g As Subtotalgroupt.SubtotalGroups.Clear()t.GroupAboveData = Falset.TreeVisible = Falset.SpillNode = True
g = New Subtotalgroupg.Aggregate = AggregateEnum.Sumg.GroupOn = "*"g.TotalOn = "第四列"g.Caption = "合计"t.SubtotalGroups.Add(g)
t.Subtotal()
t.SaveExcel("C:\test.xls","表A")