diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index 5d5068b12e..727989c2ed 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -38,6 +38,7 @@ import org.apache.poi.POIXMLDocument;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.POIXMLProperties;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
@@ -236,44 +237,35 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable Opening a XSSFWorkbook from a file has a lower memory footprint
+ * than opening from an InputStream
+ *
+ * @param file the file to open
+ */
+ public XSSFWorkbook(File file) throws IOException, InvalidFormatException {
+ this(OPCPackage.open(file));
+ }
+
/**
* Constructs a XSSFWorkbook object given a file name.
*
- *
- * This constructor is deprecated since POI-3.8 because it does not close
- * the underlying .zip file stream. In short, there are two ways to open a OPC package:
- *
- * It should be noted, that (2) uses quite a bit more memory than (1), which
- * doesn't need to hold the whole zip file in memory, and can take advantage
- * of native methods.
- *
- * To construct a workbook from file use the
- * {@link #XSSFWorkbook(org.apache.poi.openxml4j.opc.OPCPackage)} constructor:
- *
- *
- *
- *
- * OPCPackage pkg = OPCPackage.open(path);
- * XSSFWorkbook wb = new XSSFWorkbook(pkg);
- * // work with the wb object
- * ......
- * pkg.close(); // gracefully closes the underlying zip file
- *
Once you have finished working with the Workbook, you should close + * the package by calling {@link #close()}, to avoid leaving file + * handles open. + * + *
Opening a XSSFWorkbook from a file has a lower memory footprint + * than opening from an InputStream * - * @param path the file name. - * @deprecated + * @param path the file name. */ - @Deprecated public XSSFWorkbook(String path) throws IOException { this(openPackage(path)); }