Class Workbook

    • Constructor Detail

      • Workbook

        public Workbook​(OutputStream os,
                        String applicationName,
                        String applicationVersion)
        Constructor.
        Parameters:
        os - Output stream eventually holding the serialized workbook.
        applicationName - Name of the application which generated this workbook.
        applicationVersion - Version of the application. Ignored if null. Refer to this page for details.
    • Method Detail

      • setCompressionLevel

        public void setCompressionLevel​(int level)
        Sets the compression level of the xlsx. An xlsx file is a standard zip archive consisting of xml files. Default compression is 4.
        Parameters:
        level - the compression level (0-9)
      • setActiveTab

        public void setActiveTab​(int tabIndex)
      • protectStructure

        public void protectStructure​(String password)
        Protects the workbook structure with a password. Prevents users from unhiding, adding, moving, or deleting sheets. (Note that this is not very secure and only meant for discouraging changes. Same amount of protection as the edit password for worksheets.)
        Parameters:
        password - The password to use.
      • setGlobalDefaultFont

        public void setGlobalDefaultFont​(String fontName,
                                         double fontSize)
      • setGlobalDefaultFont

        public void setGlobalDefaultFont​(org.dhatim.fastexcel.Font font)
      • sortWorksheets

        public void sortWorksheets​(Comparator<Worksheet> comparator)
        Sort the current worksheets with the given Comparator
        Parameters:
        comparator - The Comparator used to sort the worksheets
      • finish

        public void finish()
                    throws IOException
        Complete workbook generation: this writes worksheets and additional files as zip entries to the output stream.
        Throws:
        IOException - In case of I/O error.
      • newWorksheet

        public Worksheet newWorksheet​(String name)
        Create a new worksheet in this workbook.
        Parameters:
        name - Name of the new worksheet.
        Returns:
        The new blank worksheet.