alibaba / easyexcel

快速、简洁、解决大文件内存溢出的java处理Excel工具
https://easyexcel.opensource.alibaba.com
Apache License 2.0
32.09k stars 7.5k forks source link

数据替换行在中间,尾行数据文字导出数据丢失,求帮助 #3955

Open wangjunjun1998 opened 1 month ago

wangjunjun1998 commented 1 month ago

建议先去看文档

快速开始常见问题

异常代码

  public static void exportExcelByTemplate(String templatePath, List<? extends DataEntity> dataList
            , HttpServletResponse response, String exportName, Map<String, Object> headData) throws Exception {
        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
        ExcelWriter excelWriter = EasyExcel
                .write(getOutputStream(exportName, response))
                .withTemplate(templatePath)
                .build();
        WriteSheet writeSheet = EasyExcel.writerSheet().build();
        FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
        excelWriter.fill(headData,fillConfig, writeSheet);
        excelWriter.fill(dataList,fillConfig, writeSheet);
        excelWriter.finish();
    }

问题描述

版本3.3.2 在使用固定模板导出文件时,索引 0 1 行为 head, 2 为数据替换行,3 为尾行文字描述 遍历数据,采取新增行方式(forceNewRow(Boolean.TRUE)),导出后,索引 3 尾行数据丢失,求告知 是被覆盖还是其他操作原因,求解决方法 ![Uploading 微信图片_20240826182713.png…]()