CSV文件生成方法:
public static File createCSVFile(List<String> head, List<List<String>> dataList,
String outPutPath, String filename) {
File csvFile = null;
BufferedWriter csvWtriter = null;
try {
csvFile = new File(outPutPath + File.separator + filename + ".csv");
File parent = csvFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
csvFile.createNewFile();
// GB2312使正确读取分隔符","
csvWtriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
csvFile), "GBK"), 1024);
// 调用方法:写入文件头部
writeRow(head, csvWtr