Class XSSFWorkbookFactory

    • Constructor Detail

      • XSSFWorkbookFactory

        public XSSFWorkbookFactory()
    • Method Detail

      • createWorkbook

        public static XSSFWorkbook createWorkbook()
        Create a new empty Workbook
        Returns:
        The created workbook
      • create

        public static XSSFWorkbook create​(OPCPackage pkg)
                                   throws java.io.IOException
        Creates a XSSFWorkbook from the given OOXML Package. This is a convenience method to go along the create-methods of the super class.

        Note that in order to properly release resources the Workbook should be closed after use.

        Parameters:
        pkg - The OPCPackage opened for reading data.
        Returns:
        The created Workbook
        Throws:
        java.io.IOException - if an error occurs while reading the data
      • createWorkbook

        public static XSSFWorkbook createWorkbook​(ZipPackage 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.

        Parameters:
        pkg - The ZipPackage opened for reading data.
        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 Package

        Note that in order to properly release resources the Workbook should be closed after use.

        Parameters:
        pkg - The OPCPackage opened for reading data.
        Returns:
        The created Workbook
        Throws:
        java.io.IOException - if an error occurs while reading the data
      • createWorkbook

        public static XSSFWorkbook createWorkbook​(java.io.File file,
                                                  boolean readOnly)
                                           throws java.io.IOException,
                                                  InvalidFormatException
        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.

        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 data
        EncryptedDocumentException - If the wrong password is given for a protected file
        InvalidFormatException
      • createWorkbook

        public static XSSFWorkbook createWorkbook​(java.io.InputStream stream)
                                           throws java.io.IOException,
                                                  InvalidFormatException
        Creates a XSSFWorkbook from the given InputStream

        Note that in order to properly release resources the Workbook should be closed after use.

        Parameters:
        stream - The InputStream to read data from.
        Returns:
        The created Workbook
        Throws:
        java.io.IOException - if an error occurs while reading the data
        InvalidFormatException - if the package is not valid.