Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog =DialogResult.OK Then
Dim t As Table = Tables("海报印刷投递表")
Dim cs As String() = {"门店", "订单号", "印刷量","投递量"}
t.StopRedraw()
Dim Book As New XLS.Book(dlg.FileName) '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
For n As Integer = 2 To Sheet.Rows.Count -1
Dim r As DataRow = t.DataTable.Find("门店 = '" & sheet(n, 0).text & "'")
If r Is Nothing Then r = t.DataTable.AddNew()
For i As Integer = 3 To sheet.Cols.Count -1
Dim cname As String = sheet(0, i).text
If array.indexof(cs,cname) >= 0 Then
r(cname) = sheet(n, i).Text
End If
Next
Next
t.ResumeRedraw()
End If
还是不行,能不能帮我看看。
我只想导入“测试”文件表里面D、E、H、I四例到Foxtable中的对应例中。其他例不要。