Dim dlg As New OpenFileDialog dlg.Filter= "Excel 97-2003 工作簿(*.xls)|*.xls|Excel 工作簿(*.xlsx)|*.xlsx" If dlg.ShowDialog = DialogResult.Ok Then Dim Book As New XLS.Book(dlg.FileName) For Each sheet As XLS.Sheet In Book.Sheets Dim mg As New Merger mg.SourcePath = dlg.FileName mg.Format = "excel" mg.SourceTableName = sheet.Name.Replace("$", "") & "$" mg.DataTableName = "工资表" '指定接收数据的表 mg.Merge() '开始合并 Next End If MessageBox.Show("导入完成" )
|