Package org.apache.poi.xssf.usermodel
Class XSSFWorkbookFactory
- java.lang.Object
-
- org.apache.poi.xssf.usermodel.XSSFWorkbookFactory
-
- All Implemented Interfaces:
WorkbookProvider
@Internal public class XSSFWorkbookFactory extends java.lang.Object implements WorkbookProvider
-
-
Constructor Summary
Constructors Constructor Description XSSFWorkbookFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(FileMagic fm)
XSSFWorkbook
create()
Create a new empty WorkbookXSSFWorkbook
create(java.io.File file, java.lang.String password, boolean readOnly)
Creates the XSSFWorkbook from the given File, which must exist and be readable.XSSFWorkbook
create(java.io.InputStream stream)
Creates a XSSFWorkbook from the given InputStreamWorkbook
create(java.io.InputStream inp, java.lang.String password)
XSSFWorkbook
create(DirectoryNode root, java.lang.String password)
static XSSFWorkbook
createWorkbook(OPCPackage pkg)
Creates a XSSFWorkbook from the given OOXML Package
-
-
-
Method Detail
-
accepts
public boolean accepts(FileMagic fm)
- Specified by:
accepts
in interfaceWorkbookProvider
-
create
public XSSFWorkbook create()
Create a new empty Workbook- Specified by:
create
in interfaceWorkbookProvider
- Returns:
- The created workbook
-
create
public XSSFWorkbook create(DirectoryNode root, java.lang.String password) throws java.io.IOException
- Specified by:
create
in interfaceWorkbookProvider
- Throws:
java.io.IOException
-
create
public Workbook create(java.io.InputStream inp, java.lang.String password) throws java.io.IOException
- Specified by:
create
in interfaceWorkbookProvider
- Throws:
java.io.IOException
-
create
public XSSFWorkbook create(java.io.InputStream stream) throws java.io.IOException
Creates a XSSFWorkbook from the given InputStreamNote that in order to properly release resources the Workbook should be closed after use.
- Specified by:
create
in interfaceWorkbookProvider
- Parameters:
stream
- TheInputStream
to read data from.- Returns:
- The created Workbook
- Throws:
java.io.IOException
- if an error occurs while reading the data
-
createWorkbook
public static XSSFWorkbook createWorkbook(OPCPackage pkg) throws java.io.IOException
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:
java.io.IOException
- if an error occurs while reading the data
-
create
public XSSFWorkbook create(java.io.File file, java.lang.String password, boolean readOnly) throws java.io.IOException
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.
- Specified by:
create
in interfaceWorkbookProvider
- 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:
java.io.IOException
- if an error occurs while reading the dataEncryptedDocumentException
- If the wrong password is given for a protected file
-
-