You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/07/03 08:52:16 UTC
[Bug 63540] New: POI writes corrupted .xlsx when adding large number
of ValidationData in a sheet
https://bz.apache.org/bugzilla/show_bug.cgi?id=63540
Bug ID: 63540
Summary: POI writes corrupted .xlsx when adding large number of
ValidationData in a sheet
Product: POI
Version: 4.0.0-FINAL
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: SXSSF
Assignee: dev@poi.apache.org
Reporter: rascse@gmail.com
Target Milestone: ---
I want to write a large .xlsx file(50K rows) using POI in JAVA. I expect each
row to contain multiple drop-down cells. Code works fine when number of rows
are less than 30K but writes a corrupt file if number of rows exceed 35K.
I have tried SXSSFWorkbook and XSSFWorkbook but none worked for me. Here is the
code:
SXSSFWorkbook workbook = new SXSSFWorkbook(100);
SXSSFSheet sheet = workbook.createSheet();
String[] optionsArray = new String[] {"1000.00","2000.00"};
int no_of_rows = 35000;
for(int i=0;i<=no_of_rows;i++) {
SXSSFRow row1 = sheet.createRow(i);
SXSSFCell r1c1 = row1.createCell(0);
DataValidationConstraint constraint1 =
sheet.getDataValidationHelper().createExplicitListConstraint(optionsArray);
CellRangeAddressList addressList1 = new CellRangeAddressList(i, i,
0, 0);
DataValidation dataValidation1 =
sheet.getDataValidationHelper().createValidation(constraint1, addressList1);
sheet.addValidationData(dataValidation1);
r1c1.setCellValue("1000.00");
SXSSFCell r1c2 = row1.createCell(1);
DataValidationConstraint constraint2 =
sheet.getDataValidationHelper().createExplicitListConstraint(optionsArray);
CellRangeAddressList addressList2 = new CellRangeAddressList(i, i,
1, 1);
DataValidation dataValidation2 =
sheet.getDataValidationHelper().createValidation(constraint2, addressList2);
sheet.addValidationData(dataValidation2);
r1c2.setCellValue("2000.00");
}
FileOutputStream fos =new FileOutputStream(new
File("c:\\data\\testout.xlsx"));
workbook.write(fos);
workbook.close();
fos.close();
I expect POI to work well with 50K rows of such data at least.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63540] POI writes corrupted .xlsx when adding large number of
ValidationData in a sheet
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63540
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
You may exceed some limitations of Excel itself, did you check Excel can handle
such a large number when you create the file elsewhere?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org