Dim TbName As String = eform.name & "_活动书目"
Dim r As Row = Tables(TbName).Current
'创建目录新建目录
If FileSys.DirectoryExists("d:\temp") = False Then '是否存在
FileSys.CreateDirectory("d:\temp")
End If
Dim ex As New Exporter
ex.SourceTableName = TbName '指定导出表
ex.FilePath = "d:\temp\" '指定目标文件路径
ex.Format = "Delimited" '导出格式为符号分割的文本文件
ex.NewTableName = "书号" & r("目录期号") '指定文件名,注意无须扩展名
ex.Fields = "书号" '指定导出列字段
ex.Header = False '不包括列名称
ex.Export() '开始导出
Dim mc As String = "书号" & r("目录期号") & ".txt"
If FileSys.FileExists("d:\temp\" & mc) Then '如果指定的文件存在
FileSys.DeleteFile("d:\temp\" & mc,2,2) '则彻底删除之
End If
Dim str As String = FileSys.ReadAllText("d:\temp\" & mc, Encoding.Default)
str = str.Replace("""", "")
str = str.Replace(",", " ")
FileSys.WriteAllText("d:\temp\" & mc, str, False, Encoding.Default)
'End If
MessageBox.Show("已成功导出书号,文本存放在d:\temp\" & mc,"提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Dim Proc As New Process '定义一个新的Process
Proc.File = "d:\temp\" '指定要打开的文件
Proc.Start()
输出乱码
生成一个名为schema配置文件
[书号1.txt]
ColNameHeader=False
CharacterSet=936
Format=CSVDelimited
Col1=书号 Char Width 26