Class BookImpl

    • Constructor Detail

      • BookImpl

        public BookImpl​(String bookName)
    • Method Detail

      • getBookSeries

        public SBookSeries getBookSeries()
        Description copied from interface: SBook
        Get the book series, it contains a group of book that might refer to other by book name
        Returns:
        book series
      • getBookName

        public String getBookName()
        Description copied from interface: SBook
        Get the book name, a book name is unique for book in SBookSeries
        Returns:
        book name;
      • getSheet

        public SSheet getSheet​(int i)
        Description copied from interface: SBook
        Get sheet at the index
        Parameters:
        i - the sheet index
        Returns:
        the sheet at the index
      • getNumOfSheet

        public int getNumOfSheet()
        Description copied from interface: SBook
        Get the number of sheet
        Returns:
        the number of sheet
      • getSheetByName

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

        public SSheet getSheetById​(String id)
        Description copied from interface: SBook
        Get the sheet by id
        Parameters:
        id - the id of sheet
        Returns:
        the sheet, or null if not found
      • checkOwnership

        protected void checkOwnership​(SSheet sheet)
      • checkOwnership

        protected void checkOwnership​(SName name)
      • createSheet

        public SSheet createSheet​(String name)
        Description copied from interface: SBook
        Create a sheet
        Parameters:
        name - the name of sheet
        Returns:
        the sheet
      • createSheet

        public SSheet createSheet​(String name,
                                  SSheet src)
        Description copied from interface: SBook
        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:
        SBook.createSheet(String, SSheet, boolean)
      • createSheet

        public SSheet createSheet​(String name,
                                  SSheet src,
                                  boolean valueOnly)
        Description copied from interface: SBook
        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
      • getRef

        protected Ref getRef()
      • setSheetName

        public void setSheetName​(SSheet sheet,
                                 String newname)
        Description copied from interface: SBook
        Set the sheet to a new name
        Parameters:
        sheet - the sheet
        newname - the new name
      • deleteSheet

        public void deleteSheet​(SSheet sheet)
        Description copied from interface: SBook
        Delete the sheet
        Parameters:
        sheet - the sheet
      • moveSheetTo

        public void moveSheetTo​(SSheet sheet,
                                int index)
        Description copied from interface: SBook
        Move the sheet to new position
        Parameters:
        sheet - the sheet
        index - the new position
      • getDefaultCellStyle

        public SCellStyle getDefaultCellStyle()
        Description copied from interface: SBook
        Get the default style of this book
        Returns:
      • getDefaultCellStyle

        public SCellStyle getDefaultCellStyle​(int index)
        Description copied from interface: SBook
        Get the nth default style of this book
        Returns:
      • getDefaultImmutableCellStyle

        public SCellStyle getDefaultImmutableCellStyle()
      • getDefaultImmutableCellStyle

        public SCellStyle getDefaultImmutableCellStyle​(int index)
      • setDefaultCellStyle

        public void setDefaultCellStyle​(SCellStyle cellStyle)
        Description copied from interface: SBook
        Set the default style of this book
      • createCellStyle

        public SCellStyle createCellStyle​(boolean inStyleTable)
        Description copied from interface: SBook
        Create a cell style
        Parameters:
        inStyleTable - if true, the new created style will be stored inside this book, then you can use SBook.searchCellStyle(CellStyleMatcher) to search and reuse this style.
      • createCellStyle

        public SCellStyle createCellStyle​(SCellStyle src,
                                          boolean inStyleTable)
        Description copied from interface: SBook
        Create a cell style and copy the style from the src style.
        Parameters:
        src - the source style to copy from.
        inStyleTable - if true, the new created style will be stored inside this book, then you can use SBook.searchCellStyle(CellStyleMatcher) to search and reuse this style.
      • addCellStyle

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

        public SCellStyleBuilder createCellStyle()
        Description copied from interface: SBook
        Create a cell style builder with default font
      • createCellStyle

        public SCellStyleBuilder createCellStyle​(SCellStyle src)
        Description copied from interface: SBook
        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.
      • searchCellStyle

        public SCellStyle searchCellStyle​(CellStyleMatcher matcher)
        Description copied from interface: SBook
        Search the style table and return the first matched style.
        Parameters:
        matcher - the style matcher
        Returns:
        the matched style.
      • addExtraStyle

        public void addExtraStyle​(SExtraStyle extraStyle)
        Description copied from interface: SBook
        Add one more extra cell style.
      • getExtraStyles

        public List<SExtraStyle> getExtraStyles()
        Description copied from interface: SBook
        Get all extra styles.
      • searchExtraStyle

        public SExtraStyle searchExtraStyle​(CellStyleMatcher matcher)
        Description copied from interface: SBook
        Search the style table and return the first matched style.
        Parameters:
        matcher - the style matcher
        Returns:
        the matched style.
      • getDefaultFont

        public SFont getDefaultFont()
      • getDefaultImmutableFont

        public SFont getDefaultImmutableFont()
      • addFont

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

        public SFontBuilder createFont()
        Description copied from interface: SBook
        Create a font builder without storing inside this book after built.
      • createFont

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

        public SFont createFont​(boolean inFontTable)
      • createFont

        public SFont createFont​(SFont src,
                                boolean inFontTable)
      • getMaxRowSize

        public int getMaxRowSize()
        Description copied from interface: SBook
        Get the max row size of this book
      • getMaxColumnSize

        public int getMaxColumnSize()
        Description copied from interface: SBook
        Get the max column size of this book
      • optimizeCellStyle

        public void optimizeCellStyle()
        Description copied from interface: SBook
        Optimize CellStyle, usually called when export book or after many style operation
      • getFontTable

        public List<SFont> getFontTable()
      • addEventListener

        public void addEventListener​(ModelEventListener listener)
        Description copied from interface: SBook
        add event listener to this book
        Parameters:
        listener - the listener
      • removeEventListener

        public void removeEventListener​(ModelEventListener listener)
        Description copied from interface: SBook
        remove event listener from this book
        Parameters:
        listener - the listener
      • getAttribute

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

        public Object setAttribute​(String name,
                                   Object value)
        Description copied from interface: SBook
        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

        public Map<String,​Object> getAttributes()
        Description copied from interface: SBook
        Get the unmodifiable runtime attributes map
        Returns:
      • createColor

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

        public SColor createColor​(String htmlColor)
      • getSheets

        public List<SSheet> getSheets()
        Description copied from interface: SBook
        Get all sheets
        Returns:
        an unmodifiable sheet list
      • createName

        public SName createName​(String namename)
      • createName

        public SName createName​(String namename,
                                String sheetName)
        Description copied from interface: SBook
        Create a defined name on specified sheet
        Returns:
        created defined name
      • setNameName

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

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

        public void deleteName​(SName name)
        Description copied from interface: SBook
        Delete a defined name
      • getNumOfName

        public int getNumOfName()
      • getName

        public SName getName​(int idx)
      • getNameByName

        public SName getNameByName​(String namename)
      • getSheetIndex

        public int getSheetIndex​(SSheet sheet)
        Description copied from interface: SBook
        Get the index of sheet
        Parameters:
        sheet - the sheet
        Returns:
        the index
      • getSheetIndex

        public int getSheetIndex​(String sheetName)
        Description copied from interface: SBook
        Get the index of sheet
        Parameters:
        sheetName - the sheet
      • setShareScope

        public void setShareScope​(String scope)
      • getShareScope

        public String getShareScope()
      • getMaxRowIndex

        public int getMaxRowIndex()
        Description copied from interface: SBook
        Get the max row index of this book, it is SBook.getMaxRowSize()-1
      • getMaxColumnIndex

        public int getMaxColumnIndex()
        Description copied from interface: SBook
        Get the max column index of this book, it is SBook.getMaxColumnIndex()-1
      • addPictureData

        public SPictureData addPictureData​(SPicture.Format format,
                                           byte[] data)
        Description copied from interface: SBook
        Add SPictureData into this book
        Parameters:
        format - picture format
        data - picture raw data
        Returns:
        the created SPictureData
      • getPictureData

        public SPictureData getPictureData​(int index)
        Description copied from interface: SBook
        Get SPictureData of the specified index from this book; null if not exist
        Returns:
        SPictureData of the specified index from this book; null if not exist
      • getNamedStyle

        public SNamedStyle getNamedStyle​(String name)
        Description copied from interface: SBook
        Get the named style of this book
        Returns:
      • addDefaultCellStyle

        public int addDefaultCellStyle​(SCellStyle cellStyle)
        Description copied from interface: SBook
        Add one more default cell style and return its index.
      • getDefaultCellStyles

        public Collection<SCellStyle> getDefaultCellStyles()
        Description copied from interface: SBook
        Get all default cell styles.
        Returns:
      • addNamedCellstyle

        public void addNamedCellstyle​(SNamedStyle namedStyle)
        Description copied from interface: SBook
        Add one more named cell style.
      • getNamedStyles

        public Collection<SNamedStyle> getNamedStyles()
        Description copied from interface: SBook
        Get all name styles.
        Returns:
      • isDirty

        public boolean isDirty()
        Description copied from interface: SBook
        Get if book is changed
        Returns:
        See Also:
        #resetDirty()
      • setDirty

        public void setDirty​(boolean dirty)
        Description copied from interface: SBook
        Set dirty flag
        See Also:
        SBook.isDirty()
      • getOrCreateDefaultHyperlinkStyle

        public SCellStyle getOrCreateDefaultHyperlinkStyle​(SCell cell)
        Description copied from interface: SBook
        Returns existing or create SCellStyle for hyperlink on the specified cell
        Returns:
      • getOrAddDefaultHyperlinkStyle

        public SCellStyle getOrAddDefaultHyperlinkStyle​(SCell cell)
        Description copied from interface: SBook
        Returns existing or add cell style for hyperlink on the specified cell
        Parameters:
        cell - the cell with hyperlink
      • getCharWidth

        public int getCharWidth()
        Office Open XML Part 4: Markup Language Reference 3.3.1.12 col (Column Width & Formatting) The character width 7 is based on Calibri 11 and character width 8 is base on Calibri 12.
        Specified by:
        getCharWidth in class AbstractBookAdv
      • getTableStyle

        public STableStyle getTableStyle​(String name)
        Description copied from interface: SBook
        Get table style of the specified name.
        Returns:
      • addTableStyle

        public void addTableStyle​(STableStyle tableStyle)
        Description copied from interface: SBook
        Add table style into this book.
      • getTableStyles

        public List<STableStyle> getTableStyles()
        Description copied from interface: SBook
        Returns table styles of this book.
        Returns:
      • clearTableStyles

        public void clearTableStyles()
        Description copied from interface: SBook
        Clear custom table styles of this book.
      • setDefaultPivotStyleName

        public void setDefaultPivotStyleName​(String name)
        Description copied from interface: SBook
        Set default pivot style name.
      • getDefaultPivotStyleName

        public String getDefaultPivotStyleName()
        Description copied from interface: SBook
        Get default pivot style name.
        Returns:
      • setDefaultTableStyleName

        public void setDefaultTableStyleName​(String name)
        Description copied from interface: SBook
        Set default table style name
      • getDefaultTableStyleName

        public String getDefaultTableStyleName()
        Description copied from interface: SBook
        Get default table style name
        Returns:
      • getDependencyTracer

        public SDependencyTracer getDependencyTracer()
        Description copied from interface: SBook
        Returns the dependency tracer.
        Returns:
      • getWorkbookProtection

        public SWorkbookProtection getWorkbookProtection()
        Description copied from interface: SBook
        Returns the workbook protection
      • setFormulaMaxIterations

        public void setFormulaMaxIterations​(int maxIterations)
        Description copied from interface: SBook
        Sets the max iterations of formula
      • getFormulaMaxIterations

        public int getFormulaMaxIterations()
        Description copied from interface: SBook
        Returns the max iterations of formula
      • setFormulaMaxChange

        public void setFormulaMaxChange​(double maxChange)
        Description copied from interface: SBook
        Sets the max change of formula
      • getFormulaMaxChange

        public double getFormulaMaxChange()
        Description copied from interface: SBook
        Returns the max change of formula
      • cloneBook

        public SBook cloneBook()
        Description copied from interface: SBook
        Clones a new book.
        Returns:
        a new book
      • getOrAddCellStyle

        public SCellStyle getOrAddCellStyle​(SCellStyle src)
        Description copied from interface: SBook
        Get the cell style which stored in this book, add it into the book if not found.
      • getOrAddExtraStyle

        public SExtraStyle getOrAddExtraStyle​(SExtraStyle src)
        Description copied from interface: SBook
        Get the extra style which stored in this book, add it into the book if not found.