Import方式导入excel表,怎么限制非文本内容的空白列导入呢?
使用过程中遇到当前excel表中只有10列 ,结果导入的时候会提示不能超过225?甚至获取到的第一行列名都大于225的 实际列只有10列,怎么增加判断呢?
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Excel97文件|*.xls|Excel2007文件|*.xlsx" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ip As New Importer
ip.SourcePath = dlg.FileName '指定数据文件\
Dim Str1 As String = FileSys.GetName(dlg.FileName) '从文件路劲中获取文件名称
Dim book As new XLS.Book(dlg.FileName)
Dim c6 As WinForm.ComboBox = e.Form.Controls("ComboBox6")
Dim a1 As Integer = c6.Value
' MessageBox.Show(book.Sheets(0).name)
ip.SourceTableName = book.Sheets(a1).name '指定要导入的表
ip.NewTableName =book.Sheets(a1).name 's '导入后的表名
If Str1 > "" AndAlso Str1.Contains("xlsx") Then
' MessageBox.Show("xlsx文件")
ip.Format="Excel2007"
Else If Str1 > "" AndAlso Str1.Contains("xls") Then
' MessageBox.Show("xls文件")
ip.Format="Excel"
End If
' MessageBox.Show("1")
ip.Import()
End If