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
同样的数据,batchDataList都是26358行, 分3次写入,多次调用这个方法, 有时返回byte[]长度=5894824,这时生成的excel可以打开; 有时返回byte[]长度=5897583,这时生成的excel打不开
ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(outputStream, clazz).registerWriteHandler(EasyExcelUtil.defaultCellFormat()); try (ExcelWriter excelWriter = excelWriterBuilder.build()) { ExcelWriterSheetBuilder sheet = excelWriterBuilder.sheet(sheetName); WriteSheet writeSheet = sheet.build(); do { batchDataList = queryFunction.apply(BatchPageParam.of(queryParam, batchIndex, batchSize)); excelWriter.write(batchDataList, writeSheet); batchIndex++; //安全防御代码。 AssertUtil.isTrue( batchIndex < batchLoopLimit, "批次数量超过上限"); // 如果数据不足 PAGE_SIZE,说明数据已全部读取完毕 } while (batchDataList.size() == batchSize); excelWriter.finish(); return outputStream.toByteArray(); }
获取字节流后,再上传到阿里云oss,在上传前打印了byte[]数组的长度。 easyexcel版本 3.2.1
背景:
The text was updated successfully, but these errors were encountered:
原因找到了:创建了两次ExcelWriter
Sorry, something went wrong.
No branches or pull requests
同样的数据,batchDataList都是26358行, 分3次写入,多次调用这个方法,
有时返回byte[]长度=5894824,这时生成的excel可以打开;
有时返回byte[]长度=5897583,这时生成的excel打不开
获取字节流后,再上传到阿里云oss,在上传前打印了byte[]数组的长度。
easyexcel版本 3.2.1
背景:
The text was updated successfully, but these errors were encountered: