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 2012/12/07 12:21:23 UTC
[Bug 53650] SXSSF can be made to output corrupt XLSX files
https://issues.apache.org/bugzilla/show_bug.cgi?id=53650
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> ---
You are overwriting an existing row which is now allowed.
SXSSF is streaming forward-only API which means it can only append data to your
template.
Your workbook already contains rows, it can easily checked as follows:
XSSFWorkbook template = new XSSFWorkbook(new
FileInputStream("template.xlsx")) ;
XSSFSheet sheet = template.getSheetAt(1);
System.out.println(sheet.getPhysicalNumberOfRows());
System.out.println(sheet.getFirstRowNum());
System.out.println(sheet.getLastRowNum());
Your code creates a row with rowIndex=1 which gets appended after the last row
in the template and it results in a corrupted workbook for two reasons:
- there is a duplicate row
- rows in sheet.xml are not ordered: rowIndex=1 comes after rowIndex=1976
I committed a fix in r1418264. Now SXSSF throws IllegalArgumentException if you
are trying to overwrite a row already saved to disk.
Yegor
--
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