Merger高速导入SourceTableName如何导入excel中所有的表?
目前我设置只能导入sheet1$这个表
Dim dlg As New OpenFileDialog
dlg.Filter = "所有文件|*.*|Excel2003文件|*.xls|Excel2007文件|*.xlsx" '设置筛选器
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
MessageBox.Show("你选择的是:" & dlg.FileNames.Length & "个文件")
If MessageBox.Show("是否合并?", "请确认!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then
DataTables("半岛进出场记录").StopRedraw
For Each fl As String In dlg.FileNames
Dim mg As New Merger
mg.SourcePath = fl
mg.Format = "excel2007" '指定格式
mg.SourceTableName = "sheet1$" '指定要合并的表
mg.DataTableName = "半岛进出场记录" '指定接收数据的表
mg.Merge() '开始合并
Next
MessageBox.Show("导入成功!", "恭喜!")
DataTables("半岛进出场记录").ResumeRedraw
End If
End If
For Each fl As String In dlg.FileNames
Dim Book As New XLS.Book(fl)
for each Sheet As XLS.Sheet in Book.Sheets
Dim mg As New Merger
mg.SourcePath = fl
mg.Format = "excel2007" '指定格式
mg.SourceTableName = Sheet.name & "$" '指定要合并的表
mg.DataTableName = "半岛进出场记录" '指定接收数据的表
mg.Merge() '开始合并
Next
Next