I use apache-poi to create Excel spreadsheet (xlsx format). When I call my finish() this causes the spreadsheet to actually be created on disk.
fos = new FileOutputStream(reportName);
workbook = new SXSSFWorkbook(FLUSH_SIZE);
.........
public void finish() throws IOException
{
for (Worksheet next : worksheets)
{
SXSSFSheet sheet = (SXSSFSheet)next.getSheet();
for (int i = 0; i < next.getMapping().size(); i++)
{
int columnWidth = next.getMapping().get(i).getColumnWidthFromValue() + FONT_MARGIN_OF_ERROR;
columnWidth = columnWidth > MAX_COL_WIDTH ? MAX_COL_WIDTH : columnWidth;
sheet.setColumnWidth(i, columnWidth * COL_WIDTH_MULTIPLIER);
}
}
workbook.write(fos);
fos.close();
workbook.dispose();
}
However, the xlsx format is actually a zipped up collection of files. Since I have to make some additional changes to the spreadsheet after it was created with apache-poi (they cannot be done with apache-poi) is there a way to make apache-poi create the files but not zip them up as an xlsx. Because the first thing I have to do is unzip them the current processing is inefficient since poi zips the files, then I have to unzip them, make modifications and then zip them up again myself.