Interface Book

All Known Implementing Classes:
BookImpl

public interface Book
This interface provides entry to access Spreadsheet's data model.
Since:
3.0.0
Author:
dennis
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Clones a new book.
    Gets the book name
    get the internal model object to do advanced operation
    Note : operate on internal object will not automatically update Spreadsheet
    Get the read-write lock of this book
    int
     
    int
     
    int
    Gets the number of sheet
    Gets share scope of this book
    Gets sheet by sheet name
    getSheetAt(int index)
    Gets sheet by index
    int
    Gets the index of sheet
    Gets the book type
    default byte[]
    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.
    boolean
    check if this book has named range
    void
    Sets share scope of this book, the possible value is "desktop","session","application"
    default void
    setVbaProject(byte[] vbaProject)
    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.
  • Method Details

    • getInternalBook

      SBook getInternalBook()
      get the internal model object to do advanced operation
      Note : operate on internal object will not automatically update Spreadsheet
      Returns:
    • getLock

      ReadWriteLock getLock()
      Get the read-write lock of this book
      Returns:
      Since:
      3.5.0
    • getBookName

      String getBookName()
      Gets the book name
      Returns:
      tge book name
    • getType

      Book.BookType getType()
      Gets the book type
      Returns:
      the book type
    • getVbaProject

      default byte[] getVbaProject()
      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()).

      Returns:
      the VBA project bytes, or null if there are no macros
      Since:
      7.0.0
    • setVbaProject

      default void setVbaProject(byte[] vbaProject)
      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[])).

      Parameters:
      vbaProject - the VBA project bytes, or null/empty to clear
      Since:
      7.0.0
    • getSheetIndex

      int getSheetIndex(Sheet sheet)
      Gets the index of sheet
      Parameters:
      sheet -
      Returns:
      the index of sheet or -1 if not found
    • getNumberOfSheets

      int getNumberOfSheets()
      Gets the number of sheet
      Returns:
      the number of sheet
    • getSheetAt

      Sheet getSheetAt(int index)
      Gets sheet by index
      Parameters:
      index - index of sheet
      Returns:
    • getSheet

      Sheet getSheet(String name)
      Gets sheet by sheet name
      Parameters:
      name - name of sheet
      Returns:
      the sheet or null if not found
    • setShareScope

      void setShareScope(String scope)
      Sets share scope of this book, the possible value is "desktop","session","application"
      Parameters:
      scope -
    • getShareScope

      String getShareScope()
      Gets share scope of this book
      Returns:
    • hasNameRange

      boolean hasNameRange(String name)
      check if this book has named range
      Parameters:
      name - the name to check
      Returns:
      true if it has a range of the name
    • getMaxRows

      int getMaxRows()
      Returns:
      the maximum number of usable rows in each sheet
    • getMaxColumns

      int getMaxColumns()
      Returns:
      the maximum number of usable column in each sheet
    • cloneBook

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