Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls;*.xlsx" If dlg.ShowDialog = DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) Tables("订单").StopRedraw() Dim nms1() As String = {"产品","客户","雇员"} Dim nms2() As String = {"表列名产品","表列名客户","表列名雇员"} For n As Integer = 1 To Sheet.Rows.Count -1 Dim r As Row = Tables("订单").AddNew() For i As Integer = 0 To sheet.Cols.Count -1 Dim idx As Integer = array.indexof(nms1, sheet(0,i).Text) If idx >= 0 Then r(nms2(idx)) = sheet(n, i).Text End If Next Next Tables("订单").ResumeRedraw() End If
|