easyexcel icon indicating copy to clipboard operation
easyexcel copied to clipboard

请问大数据导出如何控制写磁盘的时机和占用内存的大小

Open wh2206 opened this issue 1 year ago • 1 comments

最近做项目,需要帮助用户导出审批记录到excel,数据量大概100万左右,用的组件是easyexcel3.3.2,现在写的代码是:

try (ExcelWriter excelWriter = EasyExcel.write(fileName, FlowExcel.class).build()) {
    WriteSheet writeSheet = EasyExcel.writerSheet("sheet1").build();
    // 迭代数据库数据,
    flowService.iterateAllFlow(flows -> {
        // 转换数据
        List<FlowExcel> flowExcels = transferExcel(flows);
        // 写excel
        excelWriter.write(flowExcels, writeSheet);
    });
}

导出能正常工作,如果希望能控制写磁盘的时机和占用内存的大小,有相应的接口吗?要如何写?(看了文档,没有找到答案)

wh2206 avatar Nov 28 '23 02:11 wh2206