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
测试方法中 这个,之后如果要保存数据,应该加上excelWriter.finish(); 不加就会出现生成的表格里面没有sheet也没有数据
// 方法2: 如果写到不同的sheet 同一个对象 fileName = TestFileUtil.getPath() + "repeatedWrite" + System.currentTimeMillis() + ".xlsx"; // 这里 指定文件 try (ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build()) { // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来。这里最终会写到5个sheet里面 for (int i = 0; i < 5; i++) { // 每次都要创建writeSheet 这里注意必须指定sheetNo 而且sheetName必须不一样 WriteSheet writeSheet = EasyExcel.writerSheet(i, "模板" + i).build(); // 分页去数据库查询数据 这里可以去数据库查询每一页的数据 List<DemoData> data = data(); excelWriter.write(data, writeSheet); } }
没有达到效果就会出现类似下图 sheet名字并不是想要的,并且sheet里面没有数据信息
The text was updated successfully, but these errors were encountered:
try (ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build()){}
这种try-with-resource 的写法,会在try完成后,自动执行close方法,close会调用finish.
如果你在try里面用这个文件,那么可能出现这种情况,请在try后面再看这个文件试试
Sorry, something went wrong.
zhuangjiaju
No branches or pull requests
触发场景描述
测试方法中
这个,之后如果要保存数据,应该加上excelWriter.finish();
不加就会出现生成的表格里面没有sheet也没有数据
触发Bug的代码
提示的异常或者没有达到的效果
没有达到效果就会出现类似下图
sheet名字并不是想要的,并且sheet里面没有数据信息
The text was updated successfully, but these errors were encountered: