Documentation of 'org.apache.poi.ss.usermodel.WorkbookFactory' Java class
WorkbookFactory
org.apache.poi.ss.usermodel

Class WorkbookFactory



  • public class WorkbookFactory
    extends java.lang.Object
    Factory for creating the appropriate kind of Workbook (be it HSSFWorkbook or XSSFWorkbook), 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 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(NPOIFSFileSystem fs)
      Creates a HSSFWorkbook from the given NPOIFSFileSystem
      static Workbook create(OPCPackage pkg)
      Creates a XSSFWorkbook from the given OOXML Package
      static Workbook create(POIFSFileSystem fs)
      Creates a HSSFWorkbook from the given POIFSFileSystem
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WorkbookFactory

        public WorkbookFactory()
    • Method Detail

      • create

        public static Workbook create(POIFSFileSystem fs)
                               throws java.io.IOException
        Creates a HSSFWorkbook from the given POIFSFileSystem

        Note 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 NPOIFSFileSystem

        Note 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 Package

        Note 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 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.

        Throws:
        EncryptedDocumentException - If the workbook given is password protected
        java.io.IOException
        InvalidFormatException
      • 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 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.

        Throws:
        EncryptedDocumentException - If the wrong password is given for a protected file
        EmptyFileException - If an empty stream is given
        java.io.IOException
        InvalidFormatException

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.