You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我使用的版本是1.4.6,当导出数据达到500行时报错:Attempting to write a row[1567] in the range [0,1567] that is already written to disk.
导出代码为:
List dataList = bareService.queryList(new BareSearchDTO());
Workbook workbook = null;
List<BareVO> bareVOList = new ArrayList<>(100);
for (int i = 0; i < dataList.size(); i++) {
System.out.print(i+",");
bareVOList.add(dataList.get(i));
if (bareVOList.size() == 100){
workbook = ExcelExportUtil.exportBigExcel(new ExportParams(), BareVO.class, new IExcelExportServer() {
@Override
public List<Object> selectListForExcelExport(Object o, int i) {
if (((int) o) < i) {return null;}
System.err.println("obj -- "+ o +" page -- "+ i);
return new ArrayList<Object>(bareVOList);
}
}, 1);
bareVOList.clear();
}
}
FileOutputStream fos = new FileOutputStream("D:/download/test_excel.xls");
workbook.write(fos);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
当i为500时报错
The text was updated successfully, but these errors were encountered:
结合文档的例子测试,可以得出,导出的实体只要含有@ExcelCollection就会造成无法导出,例如下面的代码,将注释部分打开就无法导出:
workbook = ExcelExportUtil.exportBigExcel(new ExportParams(), TestEntity.class, new IExcelExportServer() {
/**
* obj 就是下面的10,限制条件
* page 是页数,他是在分页进行文件转换,page每次+1
*/ @OverRide
public List selectListForExcelExport(Object obj, int page) {
if (((int) obj) == page) {
return null;
}
List<Object> list = new ArrayList<Object>();
for (int i = 0; i < 10000; i++) {
TestEntity client = new TestEntity();
client.setName("小明" + page);
client.setAge((page-1)*10000+i);
// List signList = new ArrayList<>();
// BareSign bareSign = new BareSign();
// bareSign.setOrders(i).setLongitude("aaa").setLatitude("bbb");
// signList.add(bareSign);
// BareSign bareSign2 = new BareSign();
// bareSign2.setOrders(i).setLongitude("ccc").setLatitude("ddd");
// signList.add(bareSign2);
// client.setBareSignList(signList);
list.add(client);
}
return list;
}
}, 2);
我使用的版本是1.4.6,当导出数据达到500行时报错:Attempting to write a row[1567] in the range [0,1567] that is already written to disk.
导出代码为:
List dataList = bareService.queryList(new BareSearchDTO());
当i为500时报错
The text was updated successfully, but these errors were encountered: