Dim Book As New XLS.Book(ProjectPath & "资料.xls") Dim Sheet As XLS.Sheet = Book.Sheets(0) Tables("资料").StopRedraw() Dim Filter As String Dim nms() As String = {"类别","品名","规格","单位"} For n As Integer = 1 To Sheet.Rows.Count - 1 Filter = "" For m As Integer = 0 To nms.Length - 1 If m > 0 Then Filter = Filter & " And " End If Filter = Filter & nms(m) & " = '" & sheet(n,m).Value & "'" Next If DataTables("资料").Find(Filter) Is Nothing Then Dim r As Row = Tables("资料").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = Sheet(n,m).Value Next End If Next Tables("资料").ResumeRedraw()
|