3
建议先去看文档 快速开始 、常见问题 触发场景描述 使用LongestMatchColumnWidthStyleStrategy写入多个sheet时,仅有第一个sheet实现了自动列宽 触发Bug的代码
ExcelWriter excelWriter = EasyExcel.write(outputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
WriteSheet sheet1 = EasyExcel.writerSheet(1).head(Data1.class).build();
excelWriter.write(list1, sheet1);
WriteSheet sheet2 = EasyExcel.writerSheet(2).head(Data2.class).build();
excelWriter.write(list2, sheet2);
WriteSheet sheet3 = EasyExcel.writerSheet(3).head(CityStatisticDto.class).build();
excelWriter.write(list3, sheet3);
excelWriter.finish();
提示的异常或者没有达到的效果 生成的excel仅有sheet1是自动列宽的