for each s as string in datatables("表名").getValues("班级名称")
Dim Book As New XLS.Book(ProjectPath & "Attachments\学籍卡.xls") '打开模板
Dim dr1 As DataRow = Tables("条件").Current.DataRow
Dim fl As String = ProjectPath & "Reports\" & s & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(1,9).Value = "<[班级名称] = '" & s &"'>"
Book.Build() '生成报表
Book.Save(fl)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
'Rg.EntireColumn.AutoFit '自动调整列宽
'Rg.EntireRow.AutoFit '自动调整行高
'Rg.WrapText = True
rg.ShrinkToFit = True
App.Visible = False
app.quit
next