-- Excel报表返回列数不正确
Dim Open As New OpenFileDialog
Open.Title = "导入数据表格"
Open.Filter = "97-2003 Excel文件|*.xls|Excel工作簿|*.xlsx"
If Open.ShowDialog = DialogResult.OK Then
Dim Book As New XLS.Book(Open.FileName) \'定义一个报表
Dim Sheet As XLS.Sheet = Book.Sheets(0) \'引用第一个表
Dim r As Integer = Sheet.Rows.Count \'返回总行数
Dim c As Integer = Sheet.Cols.Count \'返回总列数
MessageBox.Show(r & "|" & c)
End If
我有个表格文件,其中97-2003和2007格式的,返回列数都不一样,都不正确,是我代码有问题吗?