public class WorkbookFactory
extends java.lang.Object
HSSFWorkbook
or XSSFWorkbook
),
by auto-detecting from the supplied input.Constructor | Description |
---|---|
WorkbookFactory() |
Modifier and Type | Method | Description |
---|---|---|
static Workbook |
create(java.io.File file) |
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given File, which must exist and be readable.
|
static Workbook |
create(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 protected
|
static Workbook |
create(java.io.InputStream inp) |
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given InputStream.
|
static Workbook |
create(java.io.InputStream inp,
java.lang.String password) |
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given InputStream, which may be password protected.
|
static Workbook |
create(OPCPackage pkg) |
Creates a XSSFWorkbook from the given OOXML Package
|
static Workbook |
create(NPOIFSFileSystem fs) |
Creates a HSSFWorkbook from the given NPOIFSFileSystem
|
static Workbook |
create(POIFSFileSystem fs) |
Creates a HSSFWorkbook from the given POIFSFileSystem
|
public static Workbook create(POIFSFileSystem fs) throws java.io.IOException
Note that in order to properly release resources the Workbook should be closed after use.
java.io.IOException
public static Workbook create(NPOIFSFileSystem fs) throws java.io.IOException
Note that in order to properly release resources the Workbook should be closed after use.
java.io.IOException
public static Workbook create(OPCPackage pkg) throws java.io.IOException
Note that in order to properly release resources the Workbook should be closed after use.
java.io.IOException
public static Workbook create(java.io.InputStream inp) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Your input stream MUST either support mark/reset, or
be wrapped as a PushbackInputStream
! Note that
using an InputStream
has a higher memory footprint
than using a File
.
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.
EncryptedDocumentException
- If the workbook given is password protectedjava.io.IOException
InvalidFormatException
public static Workbook create(java.io.InputStream inp, java.lang.String password) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Your input stream MUST either support mark/reset, or
be wrapped as a PushbackInputStream
! Note that
using an InputStream
has a higher memory footprint
than using a File
.
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.
EncryptedDocumentException
- If the wrong password is given for a protected fileEmptyFileException
- If an empty stream is givenjava.io.IOException
InvalidFormatException
public static Workbook create(java.io.File file) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Note that in order to properly release resources the Workbook should be closed after use.
EncryptedDocumentException
- If the workbook given is password protectedjava.io.IOException
InvalidFormatException
public static Workbook create(java.io.File file, java.lang.String password) throws java.io.IOException, InvalidFormatException, EncryptedDocumentException
Note that in order to properly release resources the Workbook should be closed after use.
EncryptedDocumentException
- If the wrong password is given for a protected fileEmptyFileException
- If an empty stream is givenjava.io.IOException
InvalidFormatException
Copyright 2018 The Apache Software Foundation or its licensors, as applicable.