Foxtable(狐表)用户栏目专家坐堂 → 关于合并导入的问题


  共有2153人关注过本帖树形打印复制链接

主题:关于合并导入的问题

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/8/6 15:23:00 [显示全部帖子]

 要编写代码导入才行

 

http://www.foxtable.com/help/topics/2334.htm

 


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/8/6 15:28:00 [显示全部帖子]

参考代码

 

Dim dlg As new OpenFileDialog
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
    For Each f As String In dlg.FileNames
        Dim  Book As New XLS.Book(f)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Dim dic As new Dictionary(Of String, Integer)
        For i As Integer = 0 To sheet.Cols.Count - 1
            If sheet(0,i).Text <> Nothing
                dic.Add(sheet(0,i).Text,i)
            End If
        Next
        For  n As Integer = 1 To Sheet.Rows.Count -1
            Dim dr As DataRow =  DataTables("表A").AddNew()
            For Each c As String In dic.Keys
                If DataTables("表A").datacols.Contains(c) Then
                    dr(c) = sheet(n, dic(c)).Text
                End If
            Next
        Next
    Next
   
End If


 回到顶部