2
问题描述 使用FillConfig设置为true, 有部分模板字段未填充上,列表会写到汇总行里面去; 不使用fillConfig可以填充,但是会列表会写到汇总行里面去。
异常代码
ExcelWriter excelWriter = EasyExcel.write(file).withTemplate(template).build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
// 写入基本信息
request.setStartDate("2021-05-06");
request.setEndDate("2021-06-06");
excelWriter.fill(request, writeSheet);
// 写入列表
InvoiceStatistic s1 = new InvoiceStatistic();
s1.setPositiveAmount(new BigDecimal("201"));
s1.setMinusAmount(new BigDecimal("-201"));
s1.setTotalInvoice(201);
statistics.add(s1);
InvoiceStatistic s2 = new InvoiceStatistic();
s2.setPositiveSpentAmount(new BigDecimal("123"));
s2.setPositiveTax(new BigDecimal("23"));
s2.setMinusInvoice(22);
statistics.add(s2);
statistics.add(s1);
FillWrapper wrapperList = new FillWrapper(statistics);
excelWriter.fill(wrapperList, fillConfig, writeSheet);
// 写入汇总信息
InvoiceStatistic totalStatic = new InvoiceStatistic();
totalStatic.setPositiveAmount(new BigDecimal("201"));
totalStatic.setPositiveInvoice(22);
totalStatic.setTotalInvoice(201);
excelWriter.fill(totalStatic, writeSheet);
excelWriter.finish();
异常提示 模板:
导出展示: 使用FillConfig设置为true, 导出展示
怎么保证列表不填充到汇总行里面,麻烦帮忙看看,谢谢