EasyExcel的Bug?
程序员文章站
2024-01-08 14:01:40
...
模板有一个map参数, header/det/sum三个list.
问题:
因为header的list不定长, 所以要用到forceNewRow=true的fillConfig,那么一用就有问题了
代码如下:
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
excelWriter.fill(new FillWrapper("header",header.getList()),fillConfig,writeSheet);
excelWriter.fill(new FillWrapper("det",page.getList()),fillConfig,writeSheet);
excelWriter.fill(new FillWrapper("sum",Arrays.asList(sumBean)),fillConfig,writeSheet);
Map<String,Object> map=new HashMap<>();
map.put("datefrom",Util.dateToString(prodOutQuery.getTrxDate_lte(),null));
map.put("dateto",Util.dateToString(prodOutQuery.getTrxDate_gte(),null));
excelWriter.fill(map,writeSheet);
excelWriter.finish();
bos.flush();
生成的Excel,用excel打开就有警告,继续打开,有错位问题
打开 excel提示的这个修复记录,如下:
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error086960_07.xml</logFileName>
<summary>在文件“C:\Users\admin\Desktop\prodout-smt-2020-12-04+150909.xlsx”中检测到错误</summary>
-<repairedRecords summary="以下是修复列表:">
<repairedRecord>已修复的记录: /xl/tables/table1.xml 部分的 表 (表)</repairedRecord>
</repairedRecords>
</recoveryLog>
==================
如果模板多留几行, 把
excelWriter.fill(new FillWrapper("header",header.getList()),fillConfig,writeSheet);
改为
excelWriter.fill(new FillWrapper("header",header.getList()),writeSheet);
就问题.