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 booleanaccepts(FileMagic fm)XSSFWorkbookcreate()Create a new empty WorkbookXSSFWorkbookcreate(java.io.File file, java.lang.String password, boolean readOnly)Creates the XSSFWorkbook from the given File, which must exist and be readable.XSSFWorkbookcreate(java.io.InputStream stream)Creates a XSSFWorkbook from the given InputStreamWorkbookcreate(java.io.InputStream inp, java.lang.String password)XSSFWorkbookcreate(DirectoryNode root, java.lang.String password)static XSSFWorkbookcreateWorkbook(OPCPackage pkg)Creates a XSSFWorkbook from the given OOXML Package
-
-
-
Method Detail
-
accepts
public boolean accepts(FileMagic fm)
- Specified by:
acceptsin interfaceWorkbookProvider
-
create
public XSSFWorkbook create()
Create a new empty Workbook- Specified by:
createin interfaceWorkbookProvider- Returns:
- The created workbook
-
create
public XSSFWorkbook create(DirectoryNode root, java.lang.String password) throws java.io.IOException
- Specified by:
createin interfaceWorkbookProvider- Throws:
java.io.IOException
-
create
public Workbook create(java.io.InputStream inp, java.lang.String password) throws java.io.IOException
- Specified by:
createin 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:
createin interfaceWorkbookProvider- Parameters:
stream- TheInputStreamto 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- TheOPCPackageopened 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:
createin 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
-
-