相关代码:
excelWriter = EasyExcelFactory.write(byteArrayOutputStream).withTemplate(templateFileInputStream).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet(sheetIndex).build();
writeSheet.setSheetName(sheetNames);
// 如果有多个list 模板上必须有{前缀.} 这里的前缀就是 data1,然后多个list必须用 FillWrapper包裹
List data = sheetList.getOrDefault("data", Collections.emptyList());
if (!data.isEmpty()) {
excelWriter.fill(new FillWrapper("data", data), writeSheet);
}
List data1 = sheetList.getOrDefault("data1", Collections.emptyList());
if (!data1.isEmpty()) {
excelWriter.fill(new FillWrapper("data1", data1), writeSheet);
}
1条答案
按热度按时间6kkfgxo01#
3.3.2版本