https://bz.apache.org/bugzilla/show_bug.cgi?id=61031
Bug ID: 61031
Summary: XSSFWorkbook and SXSSFWorkbook produce different
output
Product: POI
Version: 3.15-FINAL
Hardware: Macintosh
Status: NEW
Severity: normal
Priority: P2
Component: SXSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
For the same data and code, the output produced is different (although it seems
to be functionally identical).
One difference is that the enclosed XML contains newlines for each row when
produced by SXSSF, but no newlines when produced by XSSF. There are also other
differences.
For larger files, this results in very different file sizes - the file produced
by XSSF for 5800 rows of our data is 64% of the size of the file produces by
SXSSF. This is significant - especially as SXSSF is the method preferred for
larger files.
In the example provided below, the difference is that SXSSF produces a file
that's 6 bytes smaller (the reverse of the difference we observed on larger
date).
Assuming an OutputStream output:
Workbook wb = new SXSSFWorkbook();
Sheet sh = wb.createSheet("Sheet");
Row r1 = sh.createRow(1);
r1.createCell(1).setCellValue("One");
r1.createCell(2).setCellValue("Two");
Row r2 = sh.createRow(2);
r2.createCell(1).setCellValue("One");
r2.createCell(2).setCellValue("Two");
wb.write(output); // 3318 bytes
wb.close();
SXSSFWorkbook wb = new SXSSFWorkbook();
Sheet sh = wb.createSheet("Sheet");
Row r1 = sh.createRow(1);
r1.createCell(1).setCellValue("One");
r1.createCell(2).setCellValue("Two");
Row r2 = sh.createRow(2);
r2.createCell(1).setCellValue("One");
r2.createCell(2).setCellValue("Two");
wb.write(output); // 3312 bytes
wb.dispose();
wb.close();
Observed: The amount of data written to output are different - 3318 for
XSSFWorkbook, and 3312 for SXSSFWorkbook.
Expected: Identical files produced.
(As an aside: I suspect some of the difference is due to SXSSF not using shared
strings, although I can't see how to do that on a new workbook. Regardless, the
whitespace changes still definitely exist, and it feels likely that there are
other differences)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]