Package org.apache.poi.xssf.usermodel
Class XSSFWorkbookFactory
java.lang.Object
org.apache.poi.ss.usermodel.WorkbookFactory
org.apache.poi.xssf.usermodel.XSSFWorkbookFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XSSFWorkbook
create
(OPCPackage pkg) Creates a XSSFWorkbook from the given OOXML Package.static XSSFWorkbook
Create a new empty Workbookstatic XSSFWorkbook
createWorkbook
(File file, boolean readOnly) Creates the XSSFWorkbook from the given File, which must exist and be readable.static XSSFWorkbook
createWorkbook
(InputStream stream) Creates a XSSFWorkbook from the given InputStreamstatic XSSFWorkbook
createWorkbook
(OPCPackage pkg) Creates a XSSFWorkbook from the given OOXML Packagestatic XSSFWorkbook
createWorkbook
(ZipPackage pkg) Creates a XSSFWorkbook from the given OOXML Package
-
Constructor Details
-
XSSFWorkbookFactory
public XSSFWorkbookFactory()
-
-
Method Details
-
createWorkbook
Create a new empty Workbook- Returns:
- The created workbook
-
create
Creates a XSSFWorkbook from the given OOXML Package. This is a convenience method to go along the create-methods of the super class.Note that in order to properly release resources the Workbook should be closed after use.
- Parameters:
pkg
- TheOPCPackage
opened for reading data.- Returns:
- The created Workbook
- Throws:
IOException
- if an error occurs while reading the data
-
createWorkbook
Creates a XSSFWorkbook from the given OOXML PackageNote that in order to properly release resources the Workbook should be closed after use.
- Parameters:
pkg
- TheZipPackage
opened for reading data.- Returns:
- The created Workbook
- Throws:
IOException
- if an error occurs while reading the data
-
createWorkbook
Creates a XSSFWorkbook from the given OOXML PackageNote that in order to properly release resources the Workbook should be closed after use.
- Parameters:
pkg
- TheOPCPackage
opened for reading data.- Returns:
- The created Workbook
- Throws:
IOException
- if an error occurs while reading the data
-
createWorkbook
public static XSSFWorkbook createWorkbook(File file, boolean readOnly) throws IOException, InvalidFormatException Creates the XSSFWorkbook from the given File, which must exist and be readable.Note that in order to properly release resources the Workbook should be closed after use.
- Parameters:
file
- The file to read data from.readOnly
- If the Workbook should be opened in read-only mode to avoid writing back changes when the document is closed.- Returns:
- The created Workbook
- Throws:
IOException
- if an error occurs while reading the dataEncryptedDocumentException
- If the wrong password is given for a protected fileInvalidFormatException
-
createWorkbook
public static XSSFWorkbook createWorkbook(InputStream stream) throws IOException, InvalidFormatException Creates a XSSFWorkbook from the given InputStreamNote that in order to properly release resources the Workbook should be closed after use.
- Parameters:
stream
- TheInputStream
to read data from.- Returns:
- The created Workbook
- Throws:
IOException
- if an error occurs while reading the dataInvalidFormatException
- if the package is not valid.
-