Foxtable(狐表)用户栏目专家坐堂 → [求助]合并excel数据


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

主题:[求助]合并excel数据

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


加好友 发短信
等级:六尾狐 帖子:1399 积分:10810 威望:0 精华:0 注册:2013/11/8 15:27:00
[求助]合并excel数据  发帖心情 Post By:2023/8/4 20:44:00 [只看该作者]

Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("二月", GetType(Double))
dtb.AddDef("三月", GetType(Double))
dtb.AddDef("四月", GetType(Double))
dtb.AddDef("五月", GetType(Double))
dtb.AddDef("六月", GetType(Double))
dtb.AddDef("七月", GetType(Double))
dtb.AddDef("八月", GetType(Double))
dtb.AddDef("九月", GetType(Double))
dtb.AddDef("十月", GetType(Double))
dtb.AddDef("十一月", GetType(Double))
dtb.AddDef("十二月", GetType(Double))
dtb.AddDef("一月", GetType(Double))
dtb.AddDef("合计", GetType(Double))
dtb.AddDef("编号", GetType(String), 32)
dtb.Build()

Dim Book As New XLS.Book(ProjectPath & "Attachments\目标.xlsx")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("统计").StopRedraw()

Dim nms() As String = {"二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", "一月", "合计", "编号"}

For n As Integer = 2 To 15
    Dim r As Row = Tables("统计").AddNew()
    For m As Integer = 0 To nms.Length - 1
        For m2 As Integer = 6 To nms.Length - 1
         r(nms(m)) = Sheet(n, m2).Value '目标表是从第七列开始
        Next
    Next
Next
Tables("统计").ResumeRedraw()

结果每一列都取了目标表第14列的数据

不知哪里问题
[此贴子已经被作者于2023/8/4 20:54:45编辑过]

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


加好友 发短信
等级:超级版主 帖子:111393 积分:567029 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/8/5 8:40:00 [只看该作者]

For n As Integer = 2 To 15
    Dim r As Row = Tables("统计").AddNew()
    For m As Integer = 0 To nms.Length - 1
         r(nms(m)) = Sheet(n, m + 6).Value '目标表是从第七列开始
    Next
Next

 回到顶部