|
|
@ -402,7 +402,7 @@ public class WriteTest { |
|
|
|
String fileName = TestFileUtil.getPath() + "templateWrite" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String fileName = TestFileUtil.getPath() + "templateWrite" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
|
|
|
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
|
|
|
// 这里要注意 withTemplate 的模板文件会全量存储在内存里面,所以尽量不要用于追加文件,如果文件模板文件过大会OOM
|
|
|
|
// 这里要注意 withTemplate 的模板文件会全量存储在内存里面,所以尽量不要用于追加文件,如果文件模板文件过大会OOM
|
|
|
|
// 如果要再文件中追加(无法在一个线程里面处理,可以在一个线程的建议参照多次写入的demo) 建议临时存储到数据库 或者 磁盘缓存 然后再一次性写入
|
|
|
|
// 如果要再文件中追加(无法在一个线程里面处理,可以在一个线程的建议参照多次写入的demo) 建议临时存储到数据库 或者 磁盘缓存(ehcache) 然后再一次性写入
|
|
|
|
EasyExcel.write(fileName, DemoData.class).withTemplate(templateFileName).sheet().doWrite(data()); |
|
|
|
EasyExcel.write(fileName, DemoData.class).withTemplate(templateFileName).sheet().doWrite(data()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|