www.zmcd.net > Csv.writEr utF8

Csv.writEr utF8

StreamWriter sw = new StreamWriter("成功记录.csv",false, UnicodeEncoding.GetEncoding("GB2312"));

可以设置编码. OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(file),CHARSET);CsvWriter writer = new CsvWriter(osw, CsvPreference.EXCEL_PREFERENCE);

表头其实就是"xx","xx","xx" 分割的txt一样数据。不信你用python直接读出来试试看就知道了,用记事本打开看一下。不过得注意转移哦~~掌握了这点,你可以自己写python csv读写模块~~

导出为txt,选择数据的分割方式为tab,就可以随便拷贝到.csv文件里

public class CSVFileHelper { /// /// 将DataTable中数据写入到CSV文件中 /// /// 提供保存数据的DataTable /// CSV的文件路径 public static void SaveCSV(DataTable dt, string fullPath) { FileInfo fi = new FileInfo(fullPath); if (!fi.D...

网站地图

All rights reserved Powered by www.zmcd.net

copyright ©right 2010-2021。
www.zmcd.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com