以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如何调用系统命令  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=84344)

--  作者:大红袍
--  发布时间:2016/4/28 19:34:00
--  

 直接写代码吧,参考

 

Dim mg As New Merger
mg
.SourcePath = "c:\\data\\销售管理.xls"
mg
.Format = "excel" \'指定格式
mg
.SourceTableName = "订单$" \'指定要合并的表
mg
.DataTableName = "订单" \'指定接收数据的表
mg
.Merge() \'开始合并


--  作者:大红袍
--  发布时间:2016/4/28 20:37:00
--  

那你可以这样做

 

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

 


--  作者:大红袍
--  发布时间:2016/4/28 23:30:00
--  

Dim dlg As new OpenFileDialog
dlg.Filter = "Excel文件|*.xls"
If dlg.ShowDialog = DialogResult.OK Then
    DataTables("成绩表").DeleteFor("姓名  Is  null")
    Dim Book As New XLS.Book(dlg.FileName)
    Dim Sheet As XLS.Sheet = Book.Sheets("成绩册样表")
    Tables("成绩表").ResumeRedraw()
    Tables("成绩表").StopRedraw()
    Dim nms() As String = {"学校名称","年级","班级","学号","姓名","语文","数学","英语","科学","物理","化学","政治","历史"}
    For n As Integer = 1 To Sheet.Rows.Count -1
        Dim xx As String = sheet(n,0).text
        Dim nj As String = sheet(n,1).text
        Dim bj As String = sheet(n,2).Text
        bj = iif(bj = "", "班级 is null", "班级 = \'" & bj & "\'")
        Dim bh As String = val(sheet(n,3).Text)
        bh = iif(bh = 0, "学号 is null", "学号 = \'" & bh & "\'")
        Dim xm As String = sheet(n,4).Text
        xm = iif(xm = "", "姓名 is null", "姓名 = \'" & xm & "\'")
        Dim dr As DataRow = DataTables("成绩表").Find(bh & " And 学校名称 = \'" & xx & "\' And 年级 = \'" & nj & "\' And " & bj & " and " & xm)
        If dr Is Nothing Then \'如果不存在同编号的订单
            dr =  DataTables("成绩表").AddNew()
        End If
        For m As Integer = 0 To nms.Length - 1
            dr(nms(m)) = Sheet(n,m).Value
        Next
    Next
    Tables("成绩表").ResumeRedraw()
    messagebox.show("111")
   
    DataTables("成绩表").save
End If