以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  合并数据如何去掉数据前的编号  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=176027)

--  作者:183966998
--  发布时间:2022/3/28 11:11:00
--  合并数据如何去掉数据前的编号
图片点击可在新窗口打开查看



Dim Book As New XLS.Book("C:\\Users\\jun\\Desktop\\测试.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("测试1").StopRedraw()
Dim nms() As String = {"编号","标签"}
For n As Integer = 1 To Sheet.Rows.Count -1
    Dim bh As String = sheet(n,0).Text
    Dim dr As DataRow = DataTables("测试1").Find("编号 = \'" & bh &"\'")
    If dr Is Nothing Then \'如果不存在同编号的订单
        dr =  DataTables("测试1").AddNew()
    End If
    For m As Integer = 0 To nms.Length - 1
        dr(nms(m)) = Sheet(n,m).Value
    Next
Next
Tables("测试1").ResumeRedraw()


--  作者:有点蓝
--  发布时间:2022/3/28 11:24:00
--  
For n As Integer = 1 To Sheet.Rows.Count -1
    Dim bh As String = sheet(n,0).Text
    Dim dr As DataRow = DataTables("测试1").Find("编号 = \'" & bh &"\'")
    If dr Is Nothing Then \'如果不存在同编号的订单
        dr =  DataTables("测试1").AddNew()
    End If
dr("编号") = Sheet(n,0).Value
dim s as string = Sheet(n,1).Value
for i as integer = 0 to s.length - 1
if Char.IsDigit(s(i)) then continue for
dr("标签") = s.substring(i)
exit for
next
Next

--  作者:183966998
--  发布时间:2022/3/28 14:37:00
--  
谢谢,版主