Interface SBook

  • All Known Implementing Classes:
    AbstractBookAdv, BookImpl

    public interface SBook
    The root of Spreadsheet's data model which contains sheets.
    Since:
    3.5.0
    Author:
    dennis
    • Method Detail

      • getBookName

        String getBookName()
        Get the book name, a book name is unique for book in SBookSeries
        Returns:
        book name;
      • getBookSeries

        SBookSeries getBookSeries()
        Get the book series, it contains a group of book that might refer to other by book name
        Returns:
        book series
      • getSheet

        SSheet getSheet​(int idx)
        Get sheet at the index
        Parameters:
        idx - the sheet index
        Returns:
        the sheet at the index
      • getSheetIndex

        int getSheetIndex​(SSheet sheet)
        Get the index of sheet
        Parameters:
        sheet - the sheet
        Returns:
        the index
      • getSheetIndex

        int getSheetIndex​(String sheetName)
        Get the index of sheet
        Parameters:
        sheetName - the sheet
        Since:
        3.6.0
      • getNumOfSheet

        int getNumOfSheet()
        Get the number of sheet
        Returns:
        the number of sheet
      • getSheetByName

        SSheet getSheetByName​(String name)
        Get the sheet by name
        Parameters:
        name - the name of sheet
        Returns:
        the sheet, or null if not found
      • getSheetById

        SSheet getSheetById​(String id)
        Get the sheet by id
        Parameters:
        id - the id of sheet
        Returns:
        the sheet, or null if not found
      • createSheet

        SSheet createSheet​(String name)
        Create a sheet
        Parameters:
        name - the name of sheet
        Returns:
        the sheet
      • getSheets

        List<SSheet> getSheets()
        Get all sheets
        Returns:
        an unmodifiable sheet list
      • createSheet

        SSheet createSheet​(String name,
                           SSheet src)
        Create a sheet and copy the content from the specified src sheet; note the owner book of the specified src sheet can be different from this book.
        Parameters:
        name - the name of the new created sheet; null would try to use the sheet name of the specified src sheet; if the same sheet name already used in this book then use default "SheetX" name where X is the next sheet number of this book.
        src - the source sheet to copy
        Returns:
        the sheet
        See Also:
        createSheet(String, SSheet, boolean)
      • createSheet

        SSheet createSheet​(String name,
                           SSheet src,
                           boolean valueOnly)
        Create a sheet and copy the content from the specified src sheet; note the owner book of the specified src sheet can be different from this book.
        Parameters:
        name - the name of the new created sheet; null would try to use the sheet name of the specified src sheet; if the same sheet name already used in this book then use default "SheetX" name where X is the next sheet number of this book.
        src - the source sheet to copy
        valueOnly - true to copy cell value only
        Returns:
        the sheet
        Since:
        6.0.0
      • setSheetName

        void setSheetName​(SSheet sheet,
                          String newname)
        Set the sheet to a new name
        Parameters:
        sheet - the sheet
        newname - the new name
      • deleteSheet

        void deleteSheet​(SSheet sheet)
        Delete the sheet
        Parameters:
        sheet - the sheet
      • moveSheetTo

        void moveSheetTo​(SSheet sheet,
                         int index)
        Move the sheet to new position
        Parameters:
        sheet - the sheet
        index - the new position
      • getDefaultCellStyle

        SCellStyle getDefaultCellStyle()
        Get the default style of this book
        Returns:
      • setDefaultCellStyle

        void setDefaultCellStyle​(SCellStyle cellStyle)
        Set the default style of this book
        Since:
        3.6.0
      • addCellStyle

        SCellStyleBuilder addCellStyle​(SCellStyle src)
        Create a cell style builder and copy the style from the src style, store inside this book after built, then you can use getOrAddCellStyle(SCellStyle) to find and reuse this style.
        Parameters:
        src - the source style to copy from.
        Since:
        5.3.0
      • createCellStyle

        SCellStyleBuilder createCellStyle()
        Create a cell style builder with default font
        Since:
        5.3.0
      • createCellStyle

        SCellStyleBuilder createCellStyle​(SCellStyle src)
        Create a cell style builder and copy the style from the src style, store inside this book after built,
        Parameters:
        src - the source style to copy from.
        Since:
        5.3.0
      • getOrAddCellStyle

        SCellStyle getOrAddCellStyle​(SCellStyle style)
        Get the cell style which stored in this book, add it into the book if not found.
        Since:
        5.3.0
      • addExtraStyle

        void addExtraStyle​(SExtraStyle extraStyle)
        Add one more extra cell style.
        Parameters:
        extraStyle -
        Since:
        3.8.2
      • getExtraStyles

        List<SExtraStyle> getExtraStyles()
        Get all extra styles.
        Since:
        3.8.2
      • getOrAddExtraStyle

        SExtraStyle getOrAddExtraStyle​(SExtraStyle style)
        Get the extra style which stored in this book, add it into the book if not found.
        Since:
        5.3.0
      • searchExtraStyle

        SExtraStyle searchExtraStyle​(CellStyleMatcher matcher)
        Search the style table and return the first matched style.
        Parameters:
        matcher - the style matcher
        Returns:
        the matched style.
        Since:
        3.9.0
      • getDefaultFont

        SFont getDefaultFont()
      • addFont

        SFontBuilder addFont()
        Create a font builder and store inside this book after built, then you can use searchFont(FontMatcher) to search and reuse this style.
        Since:
        5.3.0
      • addFont

        SFontBuilder addFont​(SFont src)
        Create a font builder and copy the style from the src style, store inside this book after built, then you can use searchFont(FontMatcher) to search and reuse this style.
        Since:
        5.3.0
      • createFont

        SFontBuilder createFont()
        Create a font builder without storing inside this book after built.
        Since:
        5.3.0
      • createFont

        SFontBuilder createFont​(SFont src)
        Create a font builder and copy the style from the src style, store inside this book after built, then you can use searchFont(FontMatcher) to search and reuse this style.
        Parameters:
        src - the source style to copy from.
        Since:
        5.3.0
      • createFont

        @Deprecated
        SFont createFont​(boolean inFontTable)
        Deprecated.
        As if release 5.3.0, replaced by addFont() and createFont() to build an immutable font to boost search performance
      • createColor

        SColor createColor​(byte r,
                           byte g,
                           byte b)
      • getMaxRowSize

        int getMaxRowSize()
        Get the max row size of this book
      • getMaxColumnSize

        int getMaxColumnSize()
        Get the max column size of this book
      • getMaxRowIndex

        int getMaxRowIndex()
        Get the max row index of this book, it is getMaxRowSize()-1
      • getMaxColumnIndex

        int getMaxColumnIndex()
        Get the max column index of this book, it is getMaxColumnIndex()-1
      • addEventListener

        void addEventListener​(ModelEventListener listener)
        add event listener to this book
        Parameters:
        listener - the listener
      • removeEventListener

        void removeEventListener​(ModelEventListener listener)
        remove event listener from this book
        Parameters:
        listener - the listener
      • getAttribute

        Object getAttribute​(String name)
        Get the runtime custom attribute that stored in this book
        Parameters:
        name - the attribute name
        Returns:
        the value, or null if not found
      • setAttribute

        Object setAttribute​(String name,
                            Object value)
        Set the runtime custom attribute to stored in this book, the attribute is only use for developer to stored runtime data in the book, values will not stored to excel when exporting.
        Parameters:
        name - name the attribute name
        value - the attribute value
      • getAttributes

        Map<String,​Object> getAttributes()
        Get the unmodifiable runtime attributes map
        Returns:
      • createName

        SName createName​(String name,
                         String applyToSheetName)
        Create a defined name on specified sheet
        Returns:
        created defined name
      • setNameName

        void setNameName​(SName name,
                         String newname,
                         String applyToSheetName)
      • setNameName

        void setNameName​(SName name,
                         String newname)
      • deleteName

        void deleteName​(SName name)
        Delete a defined name
      • getNumOfName

        int getNumOfName()
      • getName

        SName getName​(int idx)
      • getNameByName

        SName getNameByName​(String namename)
      • setShareScope

        void setShareScope​(String scope)
      • getShareScope

        String getShareScope()
      • optimizeCellStyle

        void optimizeCellStyle()
        Optimize CellStyle, usually called when export book or after many style operation
      • addPictureData

        SPictureData addPictureData​(SPicture.Format format,
                                    byte[] data)
        Add SPictureData into this book
        Parameters:
        format - picture format
        data - picture raw data
        Returns:
        the created SPictureData
        Since:
        3.6.0
      • getPictureData

        SPictureData getPictureData​(int index)
        Get SPictureData of the specified index from this book; null if not exist
        Parameters:
        index -
        Returns:
        SPictureData of the specified index from this book; null if not exist
        Since:
        3.6.0
      • getDefaultCellStyle

        SCellStyle getDefaultCellStyle​(int index)
        Get the nth default style of this book
        Returns:
        Since:
        3.7.0
      • addDefaultCellStyle

        int addDefaultCellStyle​(SCellStyle cellStyle)
        Add one more default cell style and return its index.
        Parameters:
        cellStyle -
        Since:
        3.7.0
      • getNamedStyle

        SNamedStyle getNamedStyle​(String name)
        Get the named style of this book
        Parameters:
        name -
        Returns:
        Since:
        3.7.0
      • addNamedCellstyle

        void addNamedCellstyle​(SNamedStyle namedStyle)
        Add one more named cell style.
        Parameters:
        namedStyle -
        Since:
        3.7.0
      • getDefaultCellStyles

        Collection<SCellStyle> getDefaultCellStyles()
        Get all default cell styles.
        Returns:
        Since:
        3.7.0
      • isDirty

        boolean isDirty()
        Get if book is changed
        Returns:
        Since:
        3.8.0
        See Also:
        #resetDirty()
      • setDirty

        void setDirty​(boolean dirty)
        Set dirty flag
        Parameters:
        dirty -
        Since:
        3.8.0
        See Also:
        isDirty()
      • getOrCreateDefaultHyperlinkStyle

        SCellStyle getOrCreateDefaultHyperlinkStyle​(SCell cell)
        Deprecated.
        As if release 5.3.0, replaced by getOrAddDefaultHyperlinkStyle(SCell) to build an immutable cell style to boost search performance.
        Returns existing or create SCellStyle for hyperlink on the specified cell
        Parameters:
        cell -
        Returns:
        Since:
        3.9.1
      • getOrAddDefaultHyperlinkStyle

        SCellStyle getOrAddDefaultHyperlinkStyle​(SCell cell)
        Returns existing or add cell style for hyperlink on the specified cell
        Parameters:
        cell - the cell with hyperlink
        Since:
        5.3.0
      • getTableStyle

        STableStyle getTableStyle​(String name)
        Get table style of the specified name.
        Parameters:
        name -
        Returns:
        Since:
        3.8.3
      • addTableStyle

        void addTableStyle​(STableStyle tableStyle)
        Add table style into this book.
        Parameters:
        tableStyle -
        Since:
        3.8.3
      • getTableStyles

        List<STableStyle> getTableStyles()
        Returns table styles of this book.
        Returns:
        Since:
        3.8.3
      • clearTableStyles

        void clearTableStyles()
        Clear custom table styles of this book.
        Since:
        3.8.3
      • setDefaultPivotStyleName

        void setDefaultPivotStyleName​(String name)
        Set default pivot style name.
        Parameters:
        name -
        Since:
        3.8.3
      • getDefaultPivotStyleName

        String getDefaultPivotStyleName()
        Get default pivot style name.
        Returns:
        Since:
        3.8.3
      • setDefaultTableStyleName

        void setDefaultTableStyleName​(String name)
        Set default table style name
        Parameters:
        name -
        Since:
        3.8.3
      • getDefaultTableStyleName

        String getDefaultTableStyleName()
        Get default table style name
        Returns:
        Since:
        3.8.3
      • getDependencyTracer

        SDependencyTracer getDependencyTracer()
        Returns the dependency tracer.
        Returns:
        Since:
        5.6.0
      • getWorkbookProtection

        SWorkbookProtection getWorkbookProtection()
        Returns the workbook protection
        Since:
        5.8.0
      • setFormulaMaxIterations

        void setFormulaMaxIterations​(int maxIterations)
        Sets the max iterations of formula
        Since:
        5.8.1
      • getFormulaMaxIterations

        int getFormulaMaxIterations()
        Returns the max iterations of formula
        Since:
        5.8.1
      • setFormulaMaxChange

        void setFormulaMaxChange​(double maxChange)
        Sets the max change of formula
        Since:
        5.8.1
      • getFormulaMaxChange

        double getFormulaMaxChange()
        Returns the max change of formula
        Since:
        5.8.1
      • cloneBook

        SBook cloneBook()
        Clones a new book.
        Returns:
        a new book
        Since:
        6.0.0