Foxtable(狐表)用户栏目专家坐堂 → [求助]关于EXCEL 多列数据 导入处理


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

主题:[求助]关于EXCEL 多列数据 导入处理

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


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

参考代码

 

Dim Book As New XLS.Book("d:\test.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Dim nms() As String = {"第一列", "第二列"}

For n As Integer = 3 To Sheet.Rows.Count-1
    For c As Integer = 0 To sheet.Cols.count-1 Step 2
        Dim r As Row = Tables("表A").AddNew()
        For m As Integer = 0 To nms.Length - 1
            r(nms(m)) = Sheet(n,c+m).Value
        Next
    Next
Next


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


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

Dim Book As New XLS.Book("d:\test.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Dim nms() As String = {"第一列", "第二列"}

For n As Integer = 3 To Sheet.Rows.Count-1
    For c As Integer = 0 To sheet.Cols.count-1 Step 2
        If Sheet(n,c).Text > "" Then
            Dim r As Row = Tables("表A").AddNew()
            For m As Integer = 0 To nms.Length - 1
                r(nms(m)) = Sheet(n,c+m).Value
            Next
        End If
    Next
Next

 


 回到顶部