Class BookImpl

java.lang.Object
io.keikai.api.model.impl.BookImpl
All Implemented Interfaces:
Book, Serializable

public class BookImpl extends Object implements Book, Serializable
Since:
3.0.0
Author:
dennis
See Also:
  • Constructor Details

  • Method Details

    • getNative

      public SBook getNative()
    • getInternalBook

      public SBook getInternalBook()
      Description copied from interface: Book
      get the internal model object to do advanced operation
      Note : operate on internal object will not automatically update Spreadsheet
      Specified by:
      getInternalBook in interface Book
      Returns:
    • getRef

      public ModelRef<SBook> getRef()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getBookName

      public String getBookName()
      Description copied from interface: Book
      Gets the book name
      Specified by:
      getBookName in interface Book
      Returns:
      tge book name
    • getType

      public Book.BookType getType()
      Description copied from interface: Book
      Gets the book type
      Specified by:
      getType in interface Book
      Returns:
      the book type
    • getVbaProject

      public byte[] getVbaProject()
      Description copied from interface: Book
      Returns the workbook's VBA macro project binary (xl/vbaProject.bin) preserved from a macro-enabled (.xlsm) import, or null when the workbook carries no macros. The bytes are the raw OLE2 macro container; Keikai does not parse them. KEIKAI-501.

      The default implementation returns null so that Book implementations that predate macro support stay source-compatible (mirrors SBook.getVbaProject()).

      Specified by:
      getVbaProject in interface Book
      Returns:
      the VBA project bytes, or null if there are no macros
    • setVbaProject

      public void setVbaProject(byte[] vbaProject)
      Description copied from interface: Book
      Installs (or, with a null/empty array, clears) the workbook's VBA macro project binary so a subsequent .xlsm export carries these bytes and Excel can run the macros. KEIKAI-501.

      The default implementation is a no-op so that Book implementations that predate macro support stay source-compatible (mirrors SBook.setVbaProject(byte[])).

      Specified by:
      setVbaProject in interface Book
      Parameters:
      vbaProject - the VBA project bytes, or null/empty to clear
    • getSheetIndex

      public int getSheetIndex(Sheet sheet)
      Description copied from interface: Book
      Gets the index of sheet
      Specified by:
      getSheetIndex in interface Book
      Returns:
      the index of sheet or -1 if not found
    • getNumberOfSheets

      public int getNumberOfSheets()
      Description copied from interface: Book
      Gets the number of sheet
      Specified by:
      getNumberOfSheets in interface Book
      Returns:
      the number of sheet
    • getSheetAt

      public SheetImpl getSheetAt(int index)
      Description copied from interface: Book
      Gets sheet by index
      Specified by:
      getSheetAt in interface Book
      Parameters:
      index - index of sheet
      Returns:
    • getSheet

      public SheetImpl getSheet(String name)
      Description copied from interface: Book
      Gets sheet by sheet name
      Specified by:
      getSheet in interface Book
      Parameters:
      name - name of sheet
      Returns:
      the sheet or null if not found
    • setShareScope

      public void setShareScope(String scope)
      Description copied from interface: Book
      Sets share scope of this book, the possible value is "desktop","session","application"
      Specified by:
      setShareScope in interface Book
    • getShareScope

      public String getShareScope()
      Description copied from interface: Book
      Gets share scope of this book
      Specified by:
      getShareScope in interface Book
      Returns:
    • hasNameRange

      public boolean hasNameRange(String name)
      Description copied from interface: Book
      check if this book has named range
      Specified by:
      hasNameRange in interface Book
      Parameters:
      name - the name to check
      Returns:
      true if it has a range of the name
    • getMaxRows

      public int getMaxRows()
      Specified by:
      getMaxRows in interface Book
      Returns:
      the maximum number of usable rows in each sheet
    • getMaxColumns

      public int getMaxColumns()
      Specified by:
      getMaxColumns in interface Book
      Returns:
      the maximum number of usable column in each sheet
    • getLock

      public ReadWriteLock getLock()
      Description copied from interface: Book
      Get the read-write lock of this book
      Specified by:
      getLock in interface Book
      Returns:
    • cloneBook

      public Book cloneBook()
      Description copied from interface: Book
      Clones a new book.
      Specified by:
      cloneBook in interface Book
      Returns:
      a new book