|
|
@ -83,14 +83,28 @@ public class FillTest { |
|
|
|
return data(); |
|
|
|
return data(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 方案3 分多次 填充 会使用文件缓存(省内存)
|
|
|
|
// 方案3.1 分多次 填充 会使用文件缓存(省内存) 使用 try-with-resources @since 3.1.0
|
|
|
|
fileName = TestFileUtil.getPath() + "listFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
fileName = TestFileUtil.getPath() + "listFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build()) { |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
// 千万别忘记关闭流
|
|
|
|
} |
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
|
|
|
|
// 方案3.2 分多次 填充 会使用文件缓存(省内存) 不使用 try-with-resources
|
|
|
|
|
|
|
|
fileName = TestFileUtil.getPath() + "listFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
// 千万别忘记close 会帮忙关闭流
|
|
|
|
|
|
|
|
if (excelWriter != null) { |
|
|
|
|
|
|
|
excelWriter.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -106,20 +120,44 @@ public class FillTest { |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "complex.xlsx"; |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "complex.xlsx"; |
|
|
|
|
|
|
|
|
|
|
|
String fileName = TestFileUtil.getPath() + "complexFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String fileName = TestFileUtil.getPath() + "complexFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
// 方案1 : 使用 try-with-resources @since 3.1.0
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build()) { |
|
|
|
// 这里注意 入参用了forceNewRow 代表在写入list的时候不管list下面有没有空行 都会创建一行,然后下面的数据往后移动。默认 是false,会直接使用下一行,如果没有则创建。
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
// forceNewRow 如果设置了true,有个缺点 就是他会把所有的数据都放到内存了,所以慎用
|
|
|
|
// 这里注意 入参用了forceNewRow 代表在写入list的时候不管list下面有没有空行 都会创建一行,然后下面的数据往后移动。默认 是false,会直接使用下一行,如果没有则创建。
|
|
|
|
// 简单的说 如果你的模板有list,且list不是最后一行,下面还有数据需要填充 就必须设置 forceNewRow=true 但是这个就会把所有数据放到内存 会很耗内存
|
|
|
|
// forceNewRow 如果设置了true,有个缺点 就是他会把所有的数据都放到内存了,所以慎用
|
|
|
|
// 如果数据量大 list不是最后一行 参照下一个
|
|
|
|
// 简单的说 如果你的模板有list,且list不是最后一行,下面还有数据需要填充 就必须设置 forceNewRow=true 但是这个就会把所有数据放到内存 会很耗内存
|
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
// 如果数据量大 list不是最后一行 参照下一个
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
Map<String, Object> map = MapUtils.newHashMap(); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
Map<String, Object> map = MapUtils.newHashMap(); |
|
|
|
map.put("total", 1000); |
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
map.put("total", 1000); |
|
|
|
excelWriter.finish(); |
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方案2 : 不使用 try-with-resources
|
|
|
|
|
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
|
|
|
|
// 这里注意 入参用了forceNewRow 代表在写入list的时候不管list下面有没有空行 都会创建一行,然后下面的数据往后移动。默认 是false,会直接使用下一行,如果没有则创建。
|
|
|
|
|
|
|
|
// forceNewRow 如果设置了true,有个缺点 就是他会把所有的数据都放到内存了,所以慎用
|
|
|
|
|
|
|
|
// 简单的说 如果你的模板有list,且list不是最后一行,下面还有数据需要填充 就必须设置 forceNewRow=true 但是这个就会把所有数据放到内存 会很耗内存
|
|
|
|
|
|
|
|
// 如果数据量大 list不是最后一行 参照下一个
|
|
|
|
|
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
|
|
|
|
Map<String, Object> map = MapUtils.newHashMap(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
|
|
|
|
map.put("total", 1000); |
|
|
|
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
// 千万别忘记close 会帮忙关闭流
|
|
|
|
|
|
|
|
if (excelWriter != null) { |
|
|
|
|
|
|
|
excelWriter.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -138,32 +176,70 @@ public class FillTest { |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "complexFillWithTable.xlsx"; |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "complexFillWithTable.xlsx"; |
|
|
|
|
|
|
|
|
|
|
|
String fileName = TestFileUtil.getPath() + "complexFillWithTable" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String fileName = TestFileUtil.getPath() + "complexFillWithTable" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
// 方案1 : 使用 try-with-resources @since 3.1.0
|
|
|
|
// 直接写入数据
|
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build()) { |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
// 直接写入数据
|
|
|
|
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
// 写入list之前的数据
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
// 写入list之前的数据
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
// list 后面还有个统计 想办法手动写入
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
// 这里偷懒直接用list 也可以用对象
|
|
|
|
|
|
|
|
List<List<String>> totalListList = ListUtils.newArrayList(); |
|
|
|
// list 后面还有个统计 想办法手动写入
|
|
|
|
List<String> totalList = ListUtils.newArrayList(); |
|
|
|
// 这里偷懒直接用list 也可以用对象
|
|
|
|
totalListList.add(totalList); |
|
|
|
List<List<String>> totalListList = ListUtils.newArrayList(); |
|
|
|
totalList.add(null); |
|
|
|
List<String> totalList = ListUtils.newArrayList(); |
|
|
|
totalList.add(null); |
|
|
|
totalListList.add(totalList); |
|
|
|
totalList.add(null); |
|
|
|
totalList.add(null); |
|
|
|
// 第四列
|
|
|
|
totalList.add(null); |
|
|
|
totalList.add("统计:1000"); |
|
|
|
totalList.add(null); |
|
|
|
// 这里是write 别和fill 搞错了
|
|
|
|
// 第四列
|
|
|
|
excelWriter.write(totalListList, writeSheet); |
|
|
|
totalList.add("统计:1000"); |
|
|
|
excelWriter.finish(); |
|
|
|
// 这里是write 别和fill 搞错了
|
|
|
|
// 总体上写法比较复杂 但是也没有想到好的版本 异步的去写入excel 不支持行的删除和移动,也不支持备注这种的写入,所以也排除了可以
|
|
|
|
excelWriter.write(totalListList, writeSheet); |
|
|
|
// 新建一个 然后一点点复制过来的方案,最后导致list需要新增行的时候,后面的列的数据没法后移,后续会继续想想解决方案
|
|
|
|
// 总体上写法比较复杂 但是也没有想到好的版本 异步的去写入excel 不支持行的删除和移动,也不支持备注这种的写入,所以也排除了可以
|
|
|
|
|
|
|
|
// 新建一个 然后一点点复制过来的方案,最后导致list需要新增行的时候,后面的列的数据没法后移,后续会继续想想解决方案
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方案2 : 不使用 try-with-resources
|
|
|
|
|
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
|
|
|
|
// 直接写入数据
|
|
|
|
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(data(), writeSheet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 写入list之前的数据
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// list 后面还有个统计 想办法手动写入
|
|
|
|
|
|
|
|
// 这里偷懒直接用list 也可以用对象
|
|
|
|
|
|
|
|
List<List<String>> totalListList = ListUtils.newArrayList(); |
|
|
|
|
|
|
|
List<String> totalList = ListUtils.newArrayList(); |
|
|
|
|
|
|
|
totalListList.add(totalList); |
|
|
|
|
|
|
|
totalList.add(null); |
|
|
|
|
|
|
|
totalList.add(null); |
|
|
|
|
|
|
|
totalList.add(null); |
|
|
|
|
|
|
|
// 第四列
|
|
|
|
|
|
|
|
totalList.add("统计:1000"); |
|
|
|
|
|
|
|
// 这里是write 别和fill 搞错了
|
|
|
|
|
|
|
|
excelWriter.write(totalListList, writeSheet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 总体上写法比较复杂 但是也没有想到好的版本 异步的去写入excel 不支持行的删除和移动,也不支持备注这种的写入,所以也排除了可以
|
|
|
|
|
|
|
|
// 新建一个 然后一点点复制过来的方案,最后导致list需要新增行的时候,后面的列的数据没法后移,后续会继续想想解决方案
|
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
// 千万别忘记close 会帮忙关闭流
|
|
|
|
|
|
|
|
if (excelWriter != null) { |
|
|
|
|
|
|
|
excelWriter.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -179,18 +255,36 @@ public class FillTest { |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "horizontal.xlsx"; |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "horizontal.xlsx"; |
|
|
|
|
|
|
|
|
|
|
|
String fileName = TestFileUtil.getPath() + "horizontalFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String fileName = TestFileUtil.getPath() + "horizontalFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
// 方案1 : 使用 try-with-resources @since 3.1.0
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build()) { |
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
// 别忘记关闭流
|
|
|
|
} |
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
|
|
|
|
// 方案2 : 不使用 try-with-resources
|
|
|
|
|
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
|
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(data(), fillConfig, writeSheet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("date", "2019年10月9日13:28:28"); |
|
|
|
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
// 千万别忘记close 会帮忙关闭流
|
|
|
|
|
|
|
|
if (excelWriter != null) { |
|
|
|
|
|
|
|
excelWriter.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -206,25 +300,51 @@ public class FillTest { |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "composite.xlsx"; |
|
|
|
TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "composite.xlsx"; |
|
|
|
|
|
|
|
|
|
|
|
String fileName = TestFileUtil.getPath() + "compositeFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String fileName = TestFileUtil.getPath() + "compositeFill" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
// 方案1 : 使用 try-with-resources @since 3.1.0
|
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build()) { |
|
|
|
// 如果有多个list 模板上必须有{前缀.} 这里的前缀就是 data1,然后多个list必须用 FillWrapper包裹
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
// 如果有多个list 模板上必须有{前缀.} 这里的前缀就是 data1,然后多个list必须用 FillWrapper包裹
|
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
//map.put("date", "2019年10月9日13:28:28");
|
|
|
|
|
|
|
|
map.put("date", new Date()); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
//map.put("date", "2019年10月9日13:28:28");
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
map.put("date", new Date()); |
|
|
|
|
|
|
|
|
|
|
|
// 别忘记关闭流
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
excelWriter.finish(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方案2 : 不使用 try-with-resources
|
|
|
|
|
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build(); |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|
|
|
|
|
FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
|
|
|
|
|
|
|
// 如果有多个list 模板上必须有{前缀.} 这里的前缀就是 data1,然后多个list必须用 FillWrapper包裹
|
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data1", data()), fillConfig, writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data2", data()), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
|
|
|
|
excelWriter.fill(new FillWrapper("data3", data()), writeSheet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
//map.put("date", "2019年10月9日13:28:28");
|
|
|
|
|
|
|
|
map.put("date", new Date()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
excelWriter.fill(map, writeSheet); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
// 千万别忘记close 会帮忙关闭流
|
|
|
|
|
|
|
|
if (excelWriter != null) { |
|
|
|
|
|
|
|
excelWriter.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<FillData> data() { |
|
|
|
private List<FillData> data() { |
|
|
|