各位老师:下面代码总计生成4个临时表,我想要的效果是这四个临时表全部导入至一个表单中
Dim zhkdmbm As DataRow = DataTables("组合框代码").DataRows(11) '组合框代码中的第11行
Dim Multi As String = zhkdmbm("列表项目") '组合框代码中的第11行的列表项目一列的值
Dim Values() As String = Multi.split("|") '用号分割成姓名数据
For Index As Integer = 0 To Values.Length - 1 '从0开始
e.Form.Controls("TextBox4").Text = Values(Index)
Dim sj As Date = e.form.controls("DateTimePicker2").Value '将当前日期赋值给DateTimePicker1
Dim d1 As Date = sj.AddDays(6) '加上6天
Dim dtb1 As New DataTableBuilder(Values(Index))
Dim ta1 As DataTable
dtb1.AddDef("零件图号", Gettype(String), 32)'字符型
dtb1.AddDef("零件名称", Gettype(String), 32)
dtb1.AddDef("零件属性", Gettype(String), 32)
dtb1.AddDef("来货数量", Gettype(Integer)) '数值型
ta1 = dtb1.Build()
Dim Cols1() As String = {"编号图号","部件名称","颜色","交检"}
Dim Cols2() As String = {"零件图号","零件名称","零件属性","来货数量"}
For Each dr1 As DataRow In DataTables("部品质量管理").Select("日期 = '" & sj & "'and 检验员 = '" & Values(Index) & "' and 序号 = 0")
Dim dr2 As DataRow = DataTables(Values(Index)).AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next
Dim jyy1 As Integer = Tables(Values(Index)).Rows.Count
Dim Book As New XLS.Book '定义一个Excel工作簿
'Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Book.Sheets.RemoveAt(0)
Book.Sheets.Add(Values(Index)) '增加一个工作表
Dim Sheet As XLS.Sheet = Book.Sheets(Values(Index)) '引用工作簿的第一个工作表
Dim bb1 As Table = Tables(Values(Index))
Dim nms1() As String = {"零件图号","零件名称","零件属性","来货数量"} '要导出的列名
For r As Integer = 0 To bb1.Rows.Count - 1 '填入数据
For c As Integer = 0 To nms1.length -1
Sheet(r + 6, c+1).Value = bb1.rows(r)(nms1(c))
Next
Next
Book.Save("c:\reports\test.xls") '保存工作簿
'Dim Proc As New Process '打开工作簿
'Proc.File = "c:\reports\test.xls"
'Proc.Start()
Next
但现在只能导出最后一个,请各位老师指教!