以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 求代码! (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=54046) |
-- 作者:xrrzzy56 -- 发布时间:2014/7/21 8:54:00 -- 求代码! 用以下方式,由excel表1向foxtable“表A"中合并数据: dim files as string()={"c:\\文件夹1\\表1.xls","c:\\文件夹2\\表1.xls","c:\\文件夹3\\表1.xls"} Tables("表A").StopRedraw() for each file as string in files Dim Book As New XLS.Book(file) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim nms() As String = {"第一列","第二列","第三列"} For n As Integer = 1 To Sheet.Rows.Count -1 Dim bh As String = sheet(n,0).Text If DataTables("表A").Find("第一列 = \'" & bh & "\'") Is Nothing Then Dim r As Row = Tables("表A").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = Sheet(n,m).Value Next End If Next next Tables("表A").ResumeRedraw() 要求excel表1中"第一列"单元格为空的行不被合并到"表A"中,求老师指导代码!!!!! |
-- 作者:Bin -- 发布时间:2014/7/21 8:58:00 -- dim files as string()={"c:\\文件夹1\\表1.xls","c:\\文件夹2\\表1.xls","c:\\文件夹3\\表1.xls"} Tables("表A").StopRedraw() for each file as string in files Dim Book As New XLS.Book(file) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim nms() As String = {"第一列","第二列","第三列"} For n As Integer = 1 To Sheet.Rows.Count -1 Dim bh As String = sheet(n,0).Text if bh <> "" then If DataTables("表A").Find("第一列 = \'" & bh & "\'") Is Nothing Then Dim r As Row = Tables("表A").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = Sheet(n,m).Value Next End If end if Next next Tables("表A").ResumeRedraw()
|
-- 作者:xrrzzy56 -- 发布时间:2014/7/21 9:09:00 -- 感谢老师了! |