能导出不同工作表名,但每个工作表的内容是全部数据,并不是和工作表名相同的部门的数据,请求帮助:
'-----先统计需要导出的部门名称
Dim g As New GroupTableBuilder("统计表24", DataTables("tps会议"))
g.Groups.AddDef("部门")
g.Totals.AddDef("课题编码", AggregateEnum.Count, "数量")
g.Decimals = 0
g.FromServer = True
g.Build()
'MainTable = Tables("统计表24")
Dim dt As Date = Date.Today
Dim Vals As List(of String)
Vals = DataTables("统计表24").GetValues("部门") '从统计表中获得所有部门的集合
Dim cmd As new sqlcommand
Dim t As Table = Tables("tps会议")
For i As Integer = 0 To Vals.Count - 1
t.Fill("select * fr om {tps会议} where 部门 = Vals(i)","litz002",False)
t.saveExcel("d:\reports\Tps会议"& dt &".xls", Vals(i))
Next