Class WorkbookFactory
- java.lang.Object
-
- org.apache.poi.ss.usermodel.WorkbookFactory
-
public class WorkbookFactory extends java.lang.ObjectFactory for creating the appropriate kind of Workbook (be itHSSFWorkbookorXSSFWorkbook), by auto-detecting from the supplied input.
-
-
Constructor Summary
Constructors Constructor and Description WorkbookFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static Workbookcreate(java.io.File file)Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given File, which must exist and be readable.static Workbookcreate(java.io.File file, java.lang.String password)Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given File, which must exist and be readable, and may be password protectedstatic Workbookcreate(java.io.InputStream inp)Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given InputStream.static Workbookcreate(java.io.InputStream inp, java.lang.String password)Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given InputStream, which may be password protected.static Workbookcreate(NPOIFSFileSystem fs)Creates a HSSFWorkbook from the given NPOIFSFileSystemstatic Workbookcreate(OPCPackage pkg)Creates a XSSFWorkbook from the given OOXML Packagestatic Workbookcreate(POIFSFileSystem fs)Creates a HSSFWorkbook from the given POIFSFileSystem
-
-
-
Method Detail
-
create
public static Workbook create(POIFSFileSystem fs) throws java.io.IOException
Creates a HSSFWorkbook from the given POIFSFileSystemNote that in order to properly release resources the Workbook should be closed after use.
- Throws:
java.io.IOException
-
create
public static Workbook create(NPOIFSFileSystem fs) throws java.io.IOException
Creates a HSSFWorkbook from the given NPOIFSFileSystemNote that in order to properly release resources the Workbook should be closed after use.
- Throws:
java.io.IOException
-
create
public static Workbook create(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.
- Throws:
java.io.IOException
-
create
public static Workbook create(java.io.InputStream inp) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given InputStream.Your input stream MUST either support mark/reset, or be wrapped as a
PushbackInputStream! Note that using anInputStreamhas a higher memory footprint than using aFile.Note that in order to properly release resources the Workbook should be closed after use. Note also that loading from an InputStream requires more memory than loading from a File, so prefer
create(File)where possible.- Throws:
EncryptedDocumentException- If the workbook given is password protectedjava.io.IOExceptionInvalidFormatException
-
create
public static Workbook create(java.io.InputStream inp, java.lang.String password) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given InputStream, which may be password protected.Your input stream MUST either support mark/reset, or be wrapped as a
PushbackInputStream! Note that using anInputStreamhas a higher memory footprint than using aFile.Note that in order to properly release resources the Workbook should be closed after use. Note also that loading from an InputStream requires more memory than loading from a File, so prefer
create(File)where possible.- Throws:
EncryptedDocumentException- If the wrong password is given for a protected fileEmptyFileException- If an empty stream is givenjava.io.IOExceptionInvalidFormatException
-
create
public static Workbook create(java.io.File file) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Creates the appropriate HSSFWorkbook / 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.
- Throws:
EncryptedDocumentException- If the workbook given is password protectedjava.io.IOExceptionInvalidFormatException
-
create
public static Workbook create(java.io.File file, java.lang.String password) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Creates the appropriate HSSFWorkbook / XSSFWorkbook from the given File, which must exist and be readable, and may be password protectedNote that in order to properly release resources the Workbook should be closed after use.
- Throws:
EncryptedDocumentException- If the wrong password is given for a protected fileEmptyFileException- If an empty stream is givenjava.io.IOExceptionInvalidFormatException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG