Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog dlg.Filter= "Excel文件|*.xls" '设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮 Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim nms() As String = {"销售金额","税额","应收款金额","出库类别"} Tables("表A").AddNew(Sheet.Rows.Count -1) For m As Integer = 0 To nms.Length - 1 For n As Integer = 1 To Sheet.Rows.Count -1 Dim r As Row = Tables("表A").Rows(n-1) If m = 3 Then If Sheet(n,m).Text = "True" OrElse Sheet(n,m).Text = "1" r(nms(m)) = True Else r(nms(m)) = False End If Else r(nms(m)) = Sheet(n,m).Value End If Next Next End If