We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多个WriteSheet都注册了WorkbookWriteHandler,但仅有全局和最后一个WriteSheet的生效
File file = new File("test-2.xlsx"); try (ExcelWriter excelWriter = EasyExcel.write(file).excelType(ExcelTypeEnum.XLSX) .registerWriteHandler(new WorkbookWriteHandler() { @Override public void afterWorkbookDispose(WorkbookWriteHandlerContext context) { WorkbookWriteHandler.super.afterWorkbookDispose(context); System.out.println("-----global"); System.out.println("-----global"); } }) .build(); ) { WriteSheet writeSheet = EasyExcel.writerSheet(0, "模板0").head(DemoData.class) .registerWriteHandler(new WorkbookWriteHandler() { @Override public void afterWorkbookDispose(WorkbookWriteHandlerContext context) { WorkbookWriteHandler.super.afterWorkbookDispose(context); System.out.println("---------模板0"); System.out.println("---------模板0"); System.out.println("---------模板0"); } }) .build(); excelWriter.write(Test02::data, writeSheet); WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "模板1") .head(DemoData.class) .registerWriteHandler(new WorkbookWriteHandler() { @Override public void afterWorkbookDispose(WorkbookWriteHandlerContext context) { WorkbookWriteHandler.super.afterWorkbookDispose(context); System.out.println("---------模板1模板1"); System.out.println("---------模板1模板1"); System.out.println("---------模板1模板1"); } }) .build(); excelWriter.write(Test02::data, writeSheet1); WriteSheet writeSheet2 = EasyExcel.writerSheet(2, "模板2") .head(DemoData.class) .registerWriteHandler(new WorkbookWriteHandler() { @Override public void afterWorkbookDispose(WorkbookWriteHandlerContext context) { WorkbookWriteHandler.super.afterWorkbookDispose(context); System.out.println("---------模板2"); System.out.println("---------模板2"); System.out.println("---------模板2"); } }) .build(); excelWriter.write(Test02::data, writeSheet2); }
输出
---------模板2 ---------模板2 ---------模板2 -----global -----global
仅有全局和最后一个WriteSheet的WorkbookWriteHandler生效
The text was updated successfully, but these errors were encountered:
zhuangjiaju
No branches or pull requests
触发场景描述
多个WriteSheet都注册了WorkbookWriteHandler,但仅有全局和最后一个WriteSheet的生效
触发Bug的代码
提示的异常或者没有达到的效果
输出
仅有全局和最后一个WriteSheet的WorkbookWriteHandler生效
The text was updated successfully, but these errors were encountered: