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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description 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.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.int
addDefaultCellStyle(SCellStyle cellStyle)
Add one more default cell style and return its index.void
addEventListener(ModelEventListener listener)
add event listener to this bookvoid
addExtraStyle(SExtraStyle extraStyle)
Add one more extra cell style.SFontBuilder
addFont()
Create a font builder and store inside this book after built, then you can usesearchFont(FontMatcher)
to search and reuse this style.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.void
addNamedCellstyle(SNamedStyle namedStyle)
Add one more named cell style.SPictureData
addPictureData(SPicture.Format format, byte[] data)
AddSPictureData
into this bookvoid
addTableStyle(STableStyle tableStyle)
Add table style into this book.void
clearTableStyles()
Clear custom table styles of this book.SBook
cloneBook()
Clones a new book.SCellStyleBuilder
createCellStyle()
Create a cell style builder with default fontSCellStyle
createCellStyle(boolean inStyleTable)
Deprecated.As if release 5.3.0, replaced byaddCellStyle()
andcreateCellStyle()
to build an immutable cell style to boost search performance.SCellStyleBuilder
createCellStyle(SCellStyle src)
Create a cell style builder and copy the style from the src style, store inside this book after built,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.SColor
createColor(byte r, byte g, byte b)
SColor
createColor(String htmlColor)
SFontBuilder
createFont()
Create a font builder without storing inside this book after built.SFont
createFont(boolean inFontTable)
Deprecated.As if release 5.3.0, replaced byaddFont()
andcreateFont()
to build an immutable font to boost search performanceSFontBuilder
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.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 performanceSName
createName(String name)
SName
createName(String name, String applyToSheetName)
Create a defined name on specified sheetSSheet
createSheet(String name)
Create a sheetSSheet
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.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.void
deleteName(SName name)
Delete a defined namevoid
deleteSheet(SSheet sheet)
Delete the sheetObject
getAttribute(String name)
Get the runtime custom attribute that stored in this bookMap<String,Object>
getAttributes()
Get the unmodifiable runtime attributes mapString
getBookName()
Get the book name, a book name is unique for book inSBookSeries
SBookSeries
getBookSeries()
Get the book series, it contains a group of book that might refer to other by book nameSCellStyle
getDefaultCellStyle()
Get the default style of this bookSCellStyle
getDefaultCellStyle(int index)
Get the nth default style of this bookCollection<SCellStyle>
getDefaultCellStyles()
Get all default cell styles.SFont
getDefaultFont()
String
getDefaultPivotStyleName()
Get default pivot style name.String
getDefaultTableStyleName()
Get default table style nameSDependencyTracer
getDependencyTracer()
Returns the dependency tracer.List<SExtraStyle>
getExtraStyles()
Get all extra styles.double
getFormulaMaxChange()
Returns the max change of formulaint
getFormulaMaxIterations()
Returns the max iterations of formulaint
getMaxColumnIndex()
Get the max column index of this book, it isgetMaxColumnIndex()
-1int
getMaxColumnSize()
Get the max column size of this bookint
getMaxRowIndex()
Get the max row index of this book, it isgetMaxRowSize()
-1int
getMaxRowSize()
Get the max row size of this bookSName
getName(int idx)
SName
getNameByName(String namename)
SName
getNameByName(String namename, String sheetName)
SNamedStyle
getNamedStyle(String name)
Get the named style of this bookCollection<SNamedStyle>
getNamedStyles()
Get all name styles.List<SName>
getNames()
int
getNumOfName()
int
getNumOfSheet()
Get the number of sheetSCellStyle
getOrAddCellStyle(SCellStyle style)
Get the cell style which stored in this book, add it into the book if not found.SCellStyle
getOrAddDefaultHyperlinkStyle(SCell cell)
Returns existing or add cell style for hyperlink on the specified cellSExtraStyle
getOrAddExtraStyle(SExtraStyle style)
Get the extra style which stored in this book, add it into the book if not found.SCellStyle
getOrCreateDefaultHyperlinkStyle(SCell cell)
Deprecated.As if release 5.3.0, replaced bygetOrAddDefaultHyperlinkStyle(SCell)
to build an immutable cell style to boost search performance.SPictureData
getPictureData(int index)
GetSPictureData
of the specified index from this book; null if not existCollection<SPictureData>
getPicturesDatas()
Returns allSPictureData
fo this book.String
getShareScope()
SSheet
getSheet(int idx)
Get sheet at the indexSSheet
getSheetById(String id)
Get the sheet by idSSheet
getSheetByName(String name)
Get the sheet by nameint
getSheetIndex(SSheet sheet)
Get the index of sheetint
getSheetIndex(String sheetName)
Get the index of sheetList<SSheet>
getSheets()
Get all sheetsSTableStyle
getTableStyle(String name)
Get table style of the specified name.List<STableStyle>
getTableStyles()
Returns table styles of this book.SWorkbookProtection
getWorkbookProtection()
Returns the workbook protectionboolean
isDirty()
Get if book is changedvoid
moveSheetTo(SSheet sheet, int index)
Move the sheet to new positionvoid
optimizeCellStyle()
Optimize CellStyle, usually called when export book or after many style operationvoid
removeEventListener(ModelEventListener listener)
remove event listener from this bookSCellStyle
searchCellStyle(CellStyleMatcher matcher)
Deprecated.As if release 5.3.0, usegetOrAddCellStyle(SCellStyle)
to find the cell styleSExtraStyle
searchExtraStyle(CellStyleMatcher matcher)
Search the style table and return the first matched style.SFont
searchFont(FontMatcher matcher)
Deprecated.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.void
setDefaultCellStyle(SCellStyle cellStyle)
Set the default style of this bookvoid
setDefaultPivotStyleName(String name)
Set default pivot style name.void
setDefaultTableStyleName(String name)
Set default table style namevoid
setDirty(boolean dirty)
Set dirty flagvoid
setFormulaMaxChange(double maxChange)
Sets the max change of formulavoid
setFormulaMaxIterations(int maxIterations)
Sets the max iterations of formulavoid
setNameName(SName name, String newname)
void
setNameName(SName name, String newname, String applyToSheetName)
void
setShareScope(String scope)
void
setSheetName(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)
AddSPictureData
into this book- Parameters:
format
- picture formatdata
- picture raw data- Returns:
- the created SPictureData
- Since:
- 3.6.0
-
getPictureData
SPictureData getPictureData(int index)
GetSPictureData
of 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 allSPictureData
fo 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
-
-