Dim dlg As New OpenFileDialog
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
Dim lst As new List(of String)
lst.Add("_Identify")
lst.Add("_Locked")
lst.Add("_SortKey")
lst.Add("时间")
Dim dict As new Dictionary(of String,String)
Dim dict2 As new Dictionary(of String,DataRow)
For Each dt As DataTable In DataTables
If dt.Name.StartsWith("数据") Then
For Each c As DataCol In dt.DataCols
If lst.Contains(c.Name) = False AndAlso dict.ContainsKey(c.Name) = False Then
dict.Add(c.Name,dt.Name)
End If
Next
For Each r As DataRow In dt.Select("")
If dict2.ContainsKey(dt.name & "|" & r("时间")) = False Then
dict2.add(dt.name & "|" & r("时间"), r)
End If
Next
End If
Next
SystemReady = False
For Each fl As String In dlg.FileNames
Dim Book As New XLS.Book(fl)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For m As Integer = 1 To Sheet.Cols.Count -1
If dict.ContainsKey(Sheet(0,m).Value) Then
For n As Integer = 1 To Sheet.Rows.Count -1
Dim dr As DataRow
Dim cl As String = dict(Sheet(0,m).Value) & "|" & Sheet(n,0).Value
If dict2.ContainsKey(cl) Then
dr = dict2(cl)
Else
dr = DataTables(dict(Sheet(0,m).Value)).AddNew()
dr("时间") = Sheet(n,0).Value
dict2.Add(cl,dr)
End If
dr(Sheet(0,m).Value) = Sheet(n,m).Value
dict2(cl) = dr
Next
End If
Next
Next
SystemReady = True
End If