Class XSSFWorkbookFactory

    • Constructor Detail

      • XSSFWorkbookFactory

        public XSSFWorkbookFactory()
    • Method Detail

      • create

        public Workbook create​(java.io.InputStream inp,
                               java.lang.String password)
                        throws java.io.IOException
        Specified by:
        create in interface WorkbookProvider
        Throws:
        java.io.IOException
      • create

        public XSSFWorkbook create​(java.io.InputStream stream)
                            throws java.io.IOException
        Creates a XSSFWorkbook from the given InputStream

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

        Specified by:
        create in interface WorkbookProvider
        Parameters:
        stream - The InputStream to 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 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
      • 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:
        create in interface WorkbookProvider
        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