Package io.keikai.api.model
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 -
Method Summary
Modifier and TypeMethodDescriptionClones a new book.Gets the book nameget the internal model object to do advanced operation
Note : operate on internal object will not automatically update SpreadsheetgetLock()Get the read-write lock of this bookintintintGets the number of sheetGets share scope of this bookGets sheet by sheet namegetSheetAt(int index) Gets sheet by indexintgetSheetIndex(Sheet sheet) Gets the index of sheetgetType()Gets the book typedefault byte[]Returns the workbook's VBA macro project binary (xl/vbaProject.bin) preserved from a macro-enabled (.xlsm) import, ornullwhen the workbook carries no macros.booleanhasNameRange(String name) check if this book has named rangevoidsetShareScope(String scope) Sets share scope of this book, the possible value is "desktop","session","application"default voidsetVbaProject(byte[] vbaProject) Installs (or, with anull/empty array, clears) the workbook's VBA macro project binary so a subsequent.xlsmexport 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, ornullwhen the workbook carries no macros. The bytes are the raw OLE2 macro container; Keikai does not parse them. KEIKAI-501.The default implementation returns
nullso thatBookimplementations that predate macro support stay source-compatible (mirrorsSBook.getVbaProject()).- Returns:
- the VBA project bytes, or
nullif there are no macros - Since:
- 7.0.0
-
setVbaProject
default void setVbaProject(byte[] vbaProject) Installs (or, with anull/empty array, clears) the workbook's VBA macro project binary so a subsequent.xlsmexport carries these bytes and Excel can run the macros. KEIKAI-501.The default implementation is a no-op so that
Bookimplementations that predate macro support stay source-compatible (mirrorsSBook.setVbaProject(byte[])).- Parameters:
vbaProject- the VBA project bytes, ornull/empty to clear- Since:
- 7.0.0
-
getSheetIndex
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
Gets sheet by index- Parameters:
index- index of sheet- Returns:
-
getSheet
Gets sheet by sheet name- Parameters:
name- name of sheet- Returns:
- the sheet or null if not found
-
hasNameRange
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
-