CSV只不过是用CRLF分行,逗号分列的一个简单文本
先做好行模板,如
Private RowTemp as string ="{0},{1},{2},....{n}"
写入文件时候分行写入
System.IO.StreamWriter.WriteLine(String.format(RowTemp,"数据1”,“数据2"...."数据n"))
Public Sub WriteTxt(ByVal FilePath As String, ByVal Infomation As String) '解压错误的时候被调用
FilePath = FilePath
Dim WriteTxt As New System.IO.StreamWriter(FilePath, True)
WriteTxt.WriteLine(Infomation)
WriteTxt.Flush()
WriteTxt.Dispose()
End Sub
调用就是:
WriteTxt("d:\abc.csv","你的内容")