atq

导航

 

List<String> list_code = null;

方案1 控制字符集:

BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName),"Shift_JIS"));
CSVPrinter printer = new CSVPrinter(bw, CSVFormat.EXCEL);

方案2 默认字符集utf8:
CSVPrinter printer = new CSVPrinter(new FileWriter(fileName),CSVFormat.EXCEL);

 

写入

printer.printRecord("id", "userName", "firstName", "lastName", "birthday");
printer.printRecord(list_code);
//bw.close();
printer.close();

posted on 2020-02-28 13:49  atq  阅读(369)  评论(0)    收藏  举报