Easyexcel导出多个表格
ExcelWriter excelWriter = null;
try {
excelWriter = EasyExcel.write(response.getOutputStream()).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "供应商基本信息").head(SupplierExportTpl.class).build();
excelWriter.write(supplierList, writeSheet);
writeSheet = EasyExcel.writerSheet(1, "支付账号").head(BankAccountExportTpl.class).build();
excelWriter.write(accountList, writeSheet);
writeSheet = EasyExcel.writerSheet(2, "联系方式").head(ContactsExportTpl.class).build();
excelWriter.write(contactsList, writeSheet);
writeSheet = EasyExcel.writerSheet(3, "生产相关").head(EquipmentExportTpl.class).build();
excelWriter.write(equipmentList, writeSheet);
writeSheet = EasyExcel.writerSheet(4, "公司资质").head(CertificateExportTpl.class).build();
excelWriter.write(certificateList, writeSheet);
} catch (IOException e) {
log.error("---exportAll,exception: ", e);
throw new IOException("下载异常");
} finally {
/*
关闭 IO
*/
if (!ObjectUtils.isEmpty(excelWriter)) {
excelWriter.finish();
}
response.getOutputStream().close();
}
标签:表格,导出,Easyexcel,writeSheet,write,build,excelWriter,EasyExcel,writerSheet
From: https://www.cnblogs.com/Y-wee/p/17202473.html