以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  导出  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=97409)

--  作者:刘林
--  发布时间:2017/3/11 19:53:00
--  导出

Dim dlg As New FolderBrowserDialog
If dlg.ShowDialog = DialogResult.Ok Then
    For Each c As String In DataTables("学生信息").GetValues("班级")
        Dim ex As new Exporter
       ex.SourceTableName = "学生信息"
        ex.FilePath = dlg.SelectedPath & c & "基本信息核对表.xlsx"
        ex.Format = "Excel2007"
             ex.Fields ="班级,学生姓名,身份证件号"
        ex.filter = "班级 = \'" & c & "\'"
        If filesys.fileexists(ex.filepath) Then
            filesys.deletefile(ex.filepath)
        End If
        ex.Export()
    Next
End If

 

 

老师,请问上面代码是想将学生信息分班导出文件保存到选择的目录里,现在是存在了上一次目录里,并且文件名前面也加了所选目录名称,是什么原因,怎么改,谢谢


--  作者:刘林
--  发布时间:2017/3/12 17:07:00
--  

请问老师这是什么原因


--  作者:有点色
--  发布时间:2017/3/12 19:35:00
--  

试试这样

 

Dim dlg As New FolderBrowserDialog
If dlg.ShowDialog = DialogResult.Ok Then
    For Each c As String In DataTables("学生信息").GetValues("班级")
        Dim ex As new Exporter
        ex.SourceTableName = "学生信息"
        ex.FilePath = dlg.SelectedPath & "\\" & c & "\\基本信息核对表.xlsx"
        ex.Format = "Excel2007"
        ex.Fields ="班级,学生姓名,身份证件号"
        ex.filter = "班级 = \'" & c & "\'"
        If filesys.fileexists(ex.filepath) Then
            filesys.deletefile(ex.filepath)
        End If
        ex.Export()
    Next
End If