Package io.keikai.model
Interface SBook
-
- All Known Implementing Classes:
AbstractBookAdv,BookImpl
public interface SBookThe root of Spreadsheet's data model which contains sheets.- Since:
- 3.5.0
- Author:
- dennis
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description SCellStyleBuilderaddCellStyle()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.SCellStyleBuilderaddCellStyle(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.SFontBuilderaddFont()Create a font builder and store inside this book after built, then you can usesearchFont(FontMatcher)to search and reuse this style.SFontBuilderaddFont(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.voidaddNamedCellstyle(SNamedStyle namedStyle)Add one more named cell style.SPictureDataaddPictureData(SPicture.Format format, byte[] data)AddSPictureDatainto this bookvoidaddTableStyle(STableStyle tableStyle)Add table style into this book.voidclearTableStyles()Clear custom table styles of this book.SBookcloneBook()Clones a new book.SCellStyleBuildercreateCellStyle()Create a cell style builder with default fontSCellStylecreateCellStyle(boolean inStyleTable)Deprecated.As if release 5.3.0, replaced byaddCellStyle()andcreateCellStyle()to build an immutable cell style to boost search performance.SCellStyleBuildercreateCellStyle(SCellStyle src)Create a cell style builder and copy the style from the src style, store inside this book after built,SCellStylecreateCellStyle(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.SColorcreateColor(byte r, byte g, byte b)SColorcreateColor(String htmlColor)SFontBuildercreateFont()Create a font builder without storing inside this book after built.SFontcreateFont(boolean inFontTable)Deprecated.As if release 5.3.0, replaced byaddFont()andcreateFont()to build an immutable font to boost search performanceSFontBuildercreateFont(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.SFontcreateFont(SFont src, boolean inFontTable)Deprecated.As if release 5.3.0, replaced byaddFont(SFont)andcreateFont(SFont)to build an immutable font to boost search performanceSNamecreateName(String name)SNamecreateName(String name, String applyToSheetName)Create a defined name on specified sheetSSheetcreateSheet(String name)Create a sheetSSheetcreateSheet(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.SSheetcreateSheet(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 sheetObjectgetAttribute(String name)Get the runtime custom attribute that stored in this bookMap<String,Object>getAttributes()Get the unmodifiable runtime attributes mapStringgetBookName()Get the book name, a book name is unique for book inSBookSeriesSBookSeriesgetBookSeries()Get the book series, it contains a group of book that might refer to other by book nameSCellStylegetDefaultCellStyle()Get the default style of this bookSCellStylegetDefaultCellStyle(int index)Get the nth default style of this bookCollection<SCellStyle>getDefaultCellStyles()Get all default cell styles.SFontgetDefaultFont()StringgetDefaultPivotStyleName()Get default pivot style name.StringgetDefaultTableStyleName()Get default table style nameSDependencyTracergetDependencyTracer()Returns the dependency tracer.List<SExtraStyle>getExtraStyles()Get all extra styles.doublegetFormulaMaxChange()Returns the max change of formulaintgetFormulaMaxIterations()Returns the max iterations of formulaintgetMaxColumnIndex()Get the max column index of this book, it isgetMaxColumnIndex()-1intgetMaxColumnSize()Get the max column size of this bookintgetMaxRowIndex()Get the max row index of this book, it isgetMaxRowSize()-1intgetMaxRowSize()Get the max row size of this bookSNamegetName(int idx)SNamegetNameByName(String namename)SNamegetNameByName(String namename, String sheetName)SNamedStylegetNamedStyle(String name)Get the named style of this bookCollection<SNamedStyle>getNamedStyles()Get all name styles.List<SName>getNames()intgetNumOfName()intgetNumOfSheet()Get the number of sheetSCellStylegetOrAddCellStyle(SCellStyle style)Get the cell style which stored in this book, add it into the book if not found.SCellStylegetOrAddDefaultHyperlinkStyle(SCell cell)Returns existing or add cell style for hyperlink on the specified cellSExtraStylegetOrAddExtraStyle(SExtraStyle style)Get the extra style which stored in this book, add it into the book if not found.SCellStylegetOrCreateDefaultHyperlinkStyle(SCell cell)Deprecated.As if release 5.3.0, replaced bygetOrAddDefaultHyperlinkStyle(SCell)to build an immutable cell style to boost search performance.SPictureDatagetPictureData(int index)GetSPictureDataof the specified index from this book; null if not existCollection<SPictureData>getPicturesDatas()Returns allSPictureDatafo this book.StringgetShareScope()SSheetgetSheet(int idx)Get sheet at the indexSSheetgetSheetById(String id)Get the sheet by idSSheetgetSheetByName(String name)Get the sheet by nameintgetSheetIndex(SSheet sheet)Get the index of sheetintgetSheetIndex(String sheetName)Get the index of sheetList<SSheet>getSheets()Get all sheetsSTableStylegetTableStyle(String name)Get table style of the specified name.List<STableStyle>getTableStyles()Returns table styles of this book.SWorkbookProtectiongetWorkbookProtection()Returns the workbook protectionbooleanisDirty()Get if book is changedvoidmoveSheetTo(SSheet sheet, int index)Move the sheet to new positionvoidoptimizeCellStyle()Optimize CellStyle, usually called when export book or after many style operationvoidremoveEventListener(ModelEventListener listener)remove event listener from this bookSCellStylesearchCellStyle(CellStyleMatcher matcher)Deprecated.As if release 5.3.0, usegetOrAddCellStyle(SCellStyle)to find the cell styleSExtraStylesearchExtraStyle(CellStyleMatcher matcher)Search the style table and return the first matched style.SFontsearchFont(FontMatcher matcher)Deprecated.ObjectsetAttribute(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 bookvoidsetDefaultPivotStyleName(String name)Set default pivot style name.voidsetDefaultTableStyleName(String name)Set 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 Detail
-
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
SSheet getSheet(int idx)
Get sheet at the index- Parameters:
idx- the sheet index- Returns:
- the sheet at the index
-
getSheetIndex
int getSheetIndex(SSheet sheet)
Get the index of sheet- Parameters:
sheet- the sheet- Returns:
- the index
-
getSheetIndex
int getSheetIndex(String sheetName)
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
SSheet getSheetByName(String name)
Get the sheet by name- Parameters:
name- the name of sheet- Returns:
- the sheet, or null if not found
-
getSheetById
SSheet getSheetById(String id)
Get the sheet by id- Parameters:
id- the id of sheet- Returns:
- the sheet, or null if not found
-
createSheet
SSheet createSheet(String name)
Create a sheet- Parameters:
name- the name of sheet- Returns:
- the sheet
-
createSheet
SSheet createSheet(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.- 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(String, SSheet, boolean)
-
createSheet
SSheet 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.- 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
void setSheetName(SSheet sheet, String newname)
Set the sheet to a new name- Parameters:
sheet- the sheetnewname- the new name
-
deleteSheet
void deleteSheet(SSheet sheet)
Delete the sheet- Parameters:
sheet- the sheet
-
moveSheetTo
void moveSheetTo(SSheet sheet, int index)
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
void setDefaultCellStyle(SCellStyle cellStyle)
Set the default style of this book- Since:
- 3.6.0
-
createCellStyle
@Deprecated SCellStyle createCellStyle(boolean inStyleTable)
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 SCellStyle 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.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
SCellStyleBuilder 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.- 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
SCellStyleBuilder createCellStyle(SCellStyle src)
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
SCellStyle getOrAddCellStyle(SCellStyle style)
Get the cell style which stored in this book, add it into the book if not found.- Since:
- 5.3.0
-
searchCellStyle
@Deprecated SCellStyle searchCellStyle(CellStyleMatcher matcher)
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
void addExtraStyle(SExtraStyle extraStyle)
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
SExtraStyle getOrAddExtraStyle(SExtraStyle style)
Get the extra style which stored in this book, add it into the book if not found.- Since:
- 5.3.0
-
searchExtraStyle
SExtraStyle searchExtraStyle(CellStyleMatcher matcher)
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
SFontBuilder addFont(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.- Since:
- 5.3.0
-
createFont
SFontBuilder createFont()
Create a font builder without storing inside this book after built.- Since:
- 5.3.0
-
createFont
SFontBuilder createFont(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.- Parameters:
src- the source style to copy from.- Since:
- 5.3.0
-
createFont
@Deprecated SFont createFont(boolean inFontTable)
Deprecated.As if release 5.3.0, replaced byaddFont()andcreateFont()to build an immutable font to boost search performance
-
createFont
@Deprecated SFont 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 performance
-
searchFont
@Deprecated SFont searchFont(FontMatcher matcher)
Deprecated.
-
createColor
SColor createColor(byte r, byte g, byte b)
-
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
void addEventListener(ModelEventListener listener)
add event listener to this book- Parameters:
listener- the listener
-
removeEventListener
void removeEventListener(ModelEventListener listener)
remove event listener from this book- Parameters:
listener- the listener
-
getAttribute
Object getAttribute(String name)
Get the runtime custom attribute that stored in this book- Parameters:
name- the attribute name- Returns:
- the value, or null if not found
-
setAttribute
Object 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.- Parameters:
name- name the attribute namevalue- the attribute value
-
getAttributes
Map<String,Object> getAttributes()
Get the unmodifiable runtime attributes map- Returns:
-
createName
SName createName(String name, String applyToSheetName)
Create a defined name on specified sheet- Returns:
- created defined name
-
deleteName
void deleteName(SName name)
Delete a defined name
-
getNumOfName
int getNumOfName()
-
getName
SName getName(int idx)
-
setShareScope
void setShareScope(String scope)
-
getShareScope
String getShareScope()
-
optimizeCellStyle
void optimizeCellStyle()
Optimize CellStyle, usually called when export book or after many style operation
-
addPictureData
SPictureData addPictureData(SPicture.Format format, byte[] data)
AddSPictureDatainto this book- Parameters:
format- picture formatdata- picture raw data- Returns:
- the created SPictureData
- Since:
- 3.6.0
-
getPictureData
SPictureData getPictureData(int index)
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
SCellStyle getDefaultCellStyle(int index)
Get the nth default style of this book- Returns:
- Since:
- 3.7.0
-
addDefaultCellStyle
int addDefaultCellStyle(SCellStyle cellStyle)
Add one more default cell style and return its index.- Parameters:
cellStyle-- Since:
- 3.7.0
-
getNamedStyle
SNamedStyle getNamedStyle(String name)
Get the named style of this book- Parameters:
name-- Returns:
- Since:
- 3.7.0
-
addNamedCellstyle
void addNamedCellstyle(SNamedStyle namedStyle)
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:
isDirty()
-
getOrCreateDefaultHyperlinkStyle
SCellStyle getOrCreateDefaultHyperlinkStyle(SCell cell)
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
SCellStyle getOrAddDefaultHyperlinkStyle(SCell cell)
Returns existing or add cell style for hyperlink on the specified cell- Parameters:
cell- the cell with hyperlink- Since:
- 5.3.0
-
getTableStyle
STableStyle getTableStyle(String name)
Get table style of the specified name.- Parameters:
name-- Returns:
- Since:
- 3.8.3
-
addTableStyle
void addTableStyle(STableStyle tableStyle)
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
void setDefaultPivotStyleName(String name)
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
void setDefaultTableStyleName(String name)
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
-
-