Package io.keikai.model
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 Summary
Modifier and TypeMethodDescriptionCreate a cell style builder with default font and store inside this book after built, then you can usegetOrAddCellStyle(SCellStyle)to find and reuse this style.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 usegetOrAddCellStyle(SCellStyle)to find and reuse this style.intaddDefaultCellStyle(SCellStyle cellStyle) Add one more default cell style and return its index.voidaddEventListener(ModelEventListener listener) add event listener to this bookvoidaddExtraStyle(SExtraStyle extraStyle) Add one more extra cell style.addFont()Create a font builder and store inside this book after built, then you can usesearchFont(FontMatcher)to search and reuse this style.Create a font builder and copy the style from the src style, store inside this book after built, then you can usesearchFont(FontMatcher)to search and reuse this style.voidaddNamedCellstyle(SNamedStyle namedStyle) Add one more named cell style.addPictureData(SPicture.Format format, byte[] data) AddSPictureDatainto this bookvoidaddTableStyle(STableStyle tableStyle) Add table style into this book.voidClear custom table styles of this book.Clones a new book.Create a cell style builder with default fontcreateCellStyle(boolean inStyleTable) Deprecated.Create a cell style builder and copy the style from the src style, store inside this book after built,createCellStyle(SCellStyle src, boolean inStyleTable) Deprecated.As if release 5.3.0, replaced byaddCellStyle(SCellStyle)andcreateCellStyle(SCellStyle)to build an immutable cell style to boost search performance.createColor(byte r, byte g, byte b) createColor(String htmlColor) Create a font builder without storing inside this book after built.createFont(boolean inFontTable) Deprecated.As if release 5.3.0, replaced byaddFont()andcreateFont()to build an immutable font to boost search performancecreateFont(SFont src) Create a font builder and copy the style from the src style, store inside this book after built, then you can usesearchFont(FontMatcher)to search and reuse this style.createFont(SFont src, boolean inFontTable) Deprecated.As if release 5.3.0, replaced byaddFont(SFont)andcreateFont(SFont)to build an immutable font to boost search performancecreateName(String name) createName(String name, String applyToSheetName) Create a defined name on specified sheetcreateSheet(String name) Create a sheetcreateSheet(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.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.voiddeleteName(SName name) Delete a defined namevoiddeleteSheet(SSheet sheet) Delete the sheetgetAttribute(String name) Get the runtime custom attribute that stored in this bookGet the unmodifiable runtime attributes mapGet the book name, a book name is unique for book inSBookSeriesGet the book series, it contains a group of book that might refer to other by book nameGet the default style of this bookgetDefaultCellStyle(int index) Get the nth default style of this bookGet all default cell styles.Get default pivot style name.Get default table style nameReturns the dependency tracer.Get all extra styles.doubleReturns the max change of formulaintReturns the max iterations of formulaintGet the max column index of this book, it isgetMaxColumnIndex()-1intGet the max column size of this bookintGet the max row index of this book, it isgetMaxRowSize()-1intGet the max row size of this bookgetName(int idx) getNameByName(String namename) getNameByName(String namename, String sheetName) getNamedStyle(String name) Get the named style of this bookGet all name styles.getNames()intintGet the number of sheetgetOrAddCellStyle(SCellStyle style) Get the cell style which stored in this book, add it into the book if not found.Returns existing or add cell style for hyperlink on the specified cellgetOrAddExtraStyle(SExtraStyle style) Get the extra style which stored in this book, add it into the book if not found.Deprecated.As if release 5.3.0, replaced bygetOrAddDefaultHyperlinkStyle(SCell)to build an immutable cell style to boost search performance.getPictureData(int index) GetSPictureDataof the specified index from this book; null if not existReturns allSPictureDatafo this book.getSheet(int idx) Get sheet at the indexgetSheetById(String id) Get the sheet by idgetSheetByName(String name) Get the sheet by nameintgetSheetIndex(SSheet sheet) Get the index of sheetintgetSheetIndex(String sheetName) Get the index of sheetGet all sheetsgetTableStyle(String name) Get table style of the specified name.Returns table styles of this book.Returns the workbook protectionbooleanisDirty()Get if book is changedvoidmoveSheetTo(SSheet sheet, int index) Move the sheet to new positionvoidOptimize CellStyle, usually called when export book or after many style operationvoidremoveEventListener(ModelEventListener listener) remove event listener from this booksearchCellStyle(CellStyleMatcher matcher) Deprecated.As if release 5.3.0, usegetOrAddCellStyle(SCellStyle)to find the cell stylesearchExtraStyle(CellStyleMatcher matcher) Search the style table and return the first matched style.searchFont(FontMatcher matcher) Deprecated.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.voidsetDefaultCellStyle(SCellStyle cellStyle) Set the default style of this bookvoidSet default pivot style name.voidSet default table style namevoidsetDirty(boolean dirty) Set dirty flagvoidsetFormulaMaxChange(double maxChange) Sets the max change of formulavoidsetFormulaMaxIterations(int maxIterations) Sets the max iterations of formulavoidsetNameName(SName name, String newname) voidsetNameName(SName name, String newname, String applyToSheetName) voidsetShareScope(String scope) voidsetSheetName(SSheet sheet, String newname) Set the sheet to a new name
-
Method Details
-
getBookName
String getBookName()Get the book name, a book name is unique for book inSBookSeries- 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
Get sheet at the index- Parameters:
idx- the sheet index- Returns:
- the sheet at the index
-
getSheetIndex
Get the index of sheet- Parameters:
sheet- the sheet- Returns:
- the index
-
getSheetIndex
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
Get the sheet by name- Parameters:
name- the name of sheet- Returns:
- the sheet, or null if not found
-
getSheetById
Get the sheet by id- Parameters:
id- the id of sheet- Returns:
- the sheet, or null if not found
-
createSheet
Create a sheet- Parameters:
name- the name of sheet- Returns:
- the sheet
-
getSheets
Get all sheets- Returns:
- an unmodifiable sheet list
-
createSheet
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
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 copyvalueOnly- true to copy cell value only- Returns:
- the sheet
- Since:
- 6.0.0
-
setSheetName
Set the sheet to a new name- Parameters:
sheet- the sheetnewname- the new name
-
deleteSheet
Delete the sheet- Parameters:
sheet- the sheet
-
moveSheetTo
Move the sheet to new position- Parameters:
sheet- the sheetindex- the new position
-
getDefaultCellStyle
SCellStyle getDefaultCellStyle()Get the default style of this book- Returns:
-
setDefaultCellStyle
Set the default style of this book- Since:
- 3.6.0
-
createCellStyle
Deprecated.As if release 5.3.0, replaced byaddCellStyle()andcreateCellStyle()to build an immutable cell style to boost search performance.Create a cell style- Parameters:
inStyleTable- if true, the new created style will be stored inside this book, then you can usesearchCellStyle(CellStyleMatcher)to search and reuse this style.
-
createCellStyle
Deprecated.As if release 5.3.0, replaced byaddCellStyle(SCellStyle)andcreateCellStyle(SCellStyle)to build an immutable cell style to boost search performance.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 usesearchCellStyle(CellStyleMatcher)to search and reuse this style.
-
addCellStyle
SCellStyleBuilder addCellStyle()Create a cell style builder with default font and store inside this book after built, then you can usegetOrAddCellStyle(SCellStyle)to find and reuse this style.- Since:
- 5.3.0
-
addCellStyle
Create a cell style builder and copy the style from the src style, store inside this book after built, then you can usegetOrAddCellStyle(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
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
Get the cell style which stored in this book, add it into the book if not found.- Since:
- 5.3.0
-
searchCellStyle
Deprecated.As if release 5.3.0, usegetOrAddCellStyle(SCellStyle)to find the cell styleSearch the style table and return the first matched style.- Parameters:
matcher- the style matcher- Returns:
- the matched style.
-
addExtraStyle
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
Get the extra style which stored in this book, add it into the book if not found.- Since:
- 5.3.0
-
searchExtraStyle
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 usesearchFont(FontMatcher)to search and reuse this style.- Since:
- 5.3.0
-
addFont
Create a font builder and copy the style from the src style, store inside this book after built, then you can usesearchFont(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
Create a font builder and copy the style from the src style, store inside this book after built, then you can usesearchFont(FontMatcher)to search and reuse this style.- Parameters:
src- the source style to copy from.- Since:
- 5.3.0
-
createFont
Deprecated.As if release 5.3.0, replaced byaddFont()andcreateFont()to build an immutable font to boost search performance -
createFont
Deprecated.As if release 5.3.0, replaced byaddFont(SFont)andcreateFont(SFont)to build an immutable font to boost search performance -
searchFont
Deprecated. -
createColor
-
createColor
-
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 isgetMaxRowSize()-1 -
getMaxColumnIndex
int getMaxColumnIndex()Get the max column index of this book, it isgetMaxColumnIndex()-1 -
addEventListener
add event listener to this book- Parameters:
listener- the listener
-
removeEventListener
remove event listener from this book- Parameters:
listener- the listener
-
getAttribute
Get the runtime custom attribute that stored in this book- Parameters:
name- the attribute name- Returns:
- the value, or null if not found
-
setAttribute
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 namevalue- the attribute value
-
getAttributes
Get the unmodifiable runtime attributes map- Returns:
-
createName
Create a defined name on specified sheet- Returns:
- created defined name
-
createName
-
setNameName
-
setNameName
-
deleteName
Delete a defined name -
getNumOfName
int getNumOfName() -
getName
-
getNameByName
-
getNameByName
-
getNames
-
optimizeCellStyle
void optimizeCellStyle()Optimize CellStyle, usually called when export book or after many style operation -
addPictureData
AddSPictureDatainto this book- Parameters:
format- picture formatdata- picture raw data- Returns:
- the created SPictureData
- Since:
- 3.6.0
-
getPictureData
GetSPictureDataof 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
-
getPicturesDatas
Collection<SPictureData> getPicturesDatas()Returns allSPictureDatafo this book.- Since:
- 3.6.0
-
getDefaultCellStyle
Get the nth default style of this book- Returns:
- Since:
- 3.7.0
-
addDefaultCellStyle
Add one more default cell style and return its index.- Parameters:
cellStyle-- Since:
- 3.7.0
-
getNamedStyle
Get the named style of this book- Parameters:
name-- Returns:
- Since:
- 3.7.0
-
addNamedCellstyle
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
-
getNamedStyles
Collection<SNamedStyle> getNamedStyles()Get all name 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:
-
getOrCreateDefaultHyperlinkStyle
Deprecated.As if release 5.3.0, replaced bygetOrAddDefaultHyperlinkStyle(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
Returns existing or add cell style for hyperlink on the specified cell- Parameters:
cell- the cell with hyperlink- Since:
- 5.3.0
-
getTableStyle
Get table style of the specified name.- Parameters:
name-- Returns:
- Since:
- 3.8.3
-
addTableStyle
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
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
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
-
addCellStyle()andcreateCellStyle()to build an immutable cell style to boost search performance.