• Excel大数据生成-BigExcelWriter
    • 介绍
    • 使用

    Excel大数据生成-BigExcelWriter

    介绍

    对于大量数据输出,采用ExcelWriter容易引起内存溢出,因此有了BigExcelWriter,使用方法与ExcelWriter完全一致。

    使用

    1. List<?> row1 = CollUtil.newArrayList("aa", "bb", "cc", "dd", DateUtil.date(), 3.22676575765);
    2. List<?> row2 = CollUtil.newArrayList("aa1", "bb1", "cc1", "dd1", DateUtil.date(), 250.7676);
    3. List<?> row3 = CollUtil.newArrayList("aa2", "bb2", "cc2", "dd2", DateUtil.date(), 0.111);
    4. List<?> row4 = CollUtil.newArrayList("aa3", "bb3", "cc3", "dd3", DateUtil.date(), 35);
    5. List<?> row5 = CollUtil.newArrayList("aa4", "bb4", "cc4", "dd4", DateUtil.date(), 28.00);
    6. List<List<?>> rows = CollUtil.newArrayList(row1, row2, row3, row4, row5);
    7. BigExcelWriter writer= ExcelUtil.getBigWriter("e:/xxx.xlsx");
    8. // 一次性写出内容,使用默认样式
    9. writer.write(rows);
    10. // 关闭writer,释放内存
    11. writer.close();