diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 331ad9a0f..6b9ce374f 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -907,7 +907,9 @@ public class SXSSFWorkbook implements Workbook { try { sheet.getSheetDataWriter().close(); } catch (IOException e) { - // ignore exception here + logger.log(POILogger.WARN, + "An exception occurred while closing sheet data writer for sheet " + + sheet.getSheetName() + ".", e); } } @@ -926,11 +928,8 @@ public class SXSSFWorkbook implements Workbook { @Override public void write(OutputStream stream) throws IOException { - for (SXSSFSheet sheet : _xFromSxHash.values()) - { - sheet.flushRows(); - } - + flushSheets(); + //Save the template File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx"); try @@ -956,6 +955,13 @@ public class SXSSFWorkbook implements Workbook { } } + protected void flushSheets() throws IOException { + for (SXSSFSheet sheet : _xFromSxHash.values()) + { + sheet.flushRows(); + } + } + /** * Dispose of temporary files backing this workbook on disk. * Calling this method will render the workbook unusable.