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 77690c06b..0e0f50c10 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -17,33 +17,35 @@ package org.apache.poi.xssf.streaming; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Name; -import org.apache.poi.ss.usermodel.DataFormat; -import org.apache.poi.ss.usermodel.PictureData; -import org.apache.poi.ss.usermodel.CreationHelper; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.apache.poi.xssf.usermodel.XSSFSheet; - +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.FileOutputStream; -import java.io.File; -import java.util.*; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; -import java.util.zip.ZipEntry; +import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.ss.formula.udf.UDFFinder; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.Name; +import org.apache.poi.ss.usermodel.PictureData; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.model.SharedStringsTable; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * Streaming version of XSSFWorkbook implementing the "BigGridDemo" strategy. @@ -792,6 +794,18 @@ public class SXSSFWorkbook implements Workbook return _wb.getCellStyleAt(idx); } + /** + * Closes the underlying {@link XSSFWorkbook} and {@link OPCPackage} + * on which this Workbook is based, if any. Has no effect on Worbooks + * created from scratch. + */ + @Override + public void close() throws IOException { + // Tell the base workbook to close, does nothing if + // it's a newly created one + _wb.close(); + } + /** * Write out this workbook to an Outputstream. *