Hi,
I tried to use SXSSF for the generation of large excel files. It works
perfectly file, if I don't use an existing template. As soon as I use a
template the file will be corrupt. Excel can only restore the original
template without any data I added.
This works (only relevant parts):
*final SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook(200);*
Sheet sheet = sxssfWorkbook.createSheet();
...
int currentRowIndex = firstDataRowIndex;
final List<ReportRow> rows = reportData.getRows();
for (final ReportRow reportRow : rows) {
final Row row = sheet.createRow(currentRowIndex);
final ColumnDescription[] columnNames =
reportRow.getColumnNames();
for (final ColumnDescription columnName : columnNames) {
if (!columnName.isMISOnly()) {
final Object columnValue =
reportRow.getColumnValue(columnName);
ExcelUtils.createCell(row,
columnNameToColumnMap.get(columnName), columnValue);
}
}
currentRowIndex++;
}
...
sxssfWorkbook.write(outputStream);
This does not work:
*final Workbook template =
reportData.getDescription().getTemplate(languageCode);
final SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook((XSSFWorkbook)
workbook, 200);*
Sheet sheet = sxssfWorkbook.getSheetAt(0);
...
sxssfWorkbook.write(outputStream);
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Corrupt-excels-using-SXSSF-tp5649133p5649133.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]