Package io.keikai.model.impl
Class BookImpl
java.lang.Object
io.keikai.model.impl.AbstractBookAdv
io.keikai.model.impl.BookImpl
- All Implemented Interfaces:
SBook,EvaluationContributorContainer,Serializable
- Since:
- 3.5.0
- Author:
- dennis
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a cell style builder with default font and store inside this book after built, then you can useSBook.getOrAddCellStyle(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 useSBook.getOrAddCellStyle(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 useSBook.searchFont(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 useSBook.searchFont(FontMatcher)to search and reuse this style.voidaddNamedCellstyle(SNamedStyle namedStyle) Add one more named cell style.addPictureData(SPicture.Format format, byte[] data) AddSPictureDatainto this bookvoidvoidaddTableStyle(STableStyle tableStyle) Add table style into this book.protected voidcheckOwnership(SName name) protected voidcheckOwnership(SSheet sheet) voidvoidvoidvoidClear custom table styles of this book.Clones a new book.Create a cell style builder with default fontcreateCellStyle(boolean inStyleTable) Create a cell styleCreate a cell style builder and copy the style from the src style, store inside this book after built,createCellStyle(SCellStyle src, boolean inStyleTable) Create a cell style and copy the style from the src style.createColor(byte r, byte g, byte b) createColor(String htmlColor) Create a font builder without storing inside this book after built.createFont(boolean inFontTable) createFont(SFont src) Create a font builder and copy the style from the src style, store inside this book after built, then you can useSBook.searchFont(FontMatcher)to search and reuse this style.createFont(SFont src, boolean inFontTable) createName(String namename) createName(String namename, String sheetName) 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.createTableName(STable table) voiddeleteName(SName name) Delete a defined namevoiddeleteSheet(SSheet sheet) Delete the sheetvoiddump(StringBuilder builder) getAttribute(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 namegetCellStyle(SCellStyle src) intOffice Open XML Part 4: Markup Language Reference 3.3.1.12 col (Column Width & Formatting) The character width 7 is based on Calibri 11 and character width 8 is base on Calibri 12.Get the default style of this bookgetDefaultCellStyle(int index) Get the nth default style of this bookGet all default cell styles.getDefaultImmutableCellStyle(int index) 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 formulagetId()intGet the max column index of this book, it isSBook.getMaxColumnIndex()-1intGet the max column size of this bookintGet the max row index of this book, it isSBook.getMaxRowSize()-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 sheetGet 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 cellGet the extra style which stored in this book, add it into the book if not found.getOrAddFont(SFont font) Get the font which stored in this book, or add it into the book if not found, then you can useSBook.searchFont(FontMatcher)to search and reuse this style.Returns existing or create SCellStyle for hyperlink on the specified cellgetPictureData(int index) GetSPictureDataof the specified index from this book; null if not existReturns allSPictureDatafo this book.protected RefgetRef()getSheet(int i) 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 protectionbooleanvoidvoidbooleanisDirty()Get if book is changedbooleanvoidmoveSheetTo(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 bookremoveTable(String name) voidsearchCellStyle(CellStyleMatcher matcher) Search the style table and return the first matched style.searchExtraStyle(CellStyleMatcher matcher) Search the style table and return the first matched style.searchFont(FontMatcher matcher) voidsendModelEvent(ModelEvent event) 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 bookvoidsetDefaultChartSeriesColors(List<SColor> colors) voidSet default pivot style name.voidSet default table style namevoidsetDirty(boolean dirty) Set dirty flagvoidsetEvaluationContributor(EvaluationContributor contributor) voidsetFormulaMaxChange(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 sheetName) voidsetPostProcessing(boolean b) voidsetShareScope(String scope) voidsetSheetName(SSheet sheet, String newname) Set the sheet to a new namesetTableColumnName(STable table, String oldName, String newName) voidStarts a batch mode for event notification in a workbook.voidStops the batch mode for event notification when triggers all of the events in a queue.
-
Constructor Details
-
BookImpl
-
-
Method Details
-
initDefaultCellStyles
public void initDefaultCellStyles()- Specified by:
initDefaultCellStylesin classAbstractBookAdv
-
setDefaultChartSeriesColors
- Specified by:
setDefaultChartSeriesColorsin classAbstractBookAdv
-
getDefaultChartSeriesColors
- Specified by:
getDefaultChartSeriesColorsin classAbstractBookAdv
-
getBookSeries
Description copied from interface:SBookGet the book series, it contains a group of book that might refer to other by book name- Returns:
- book series
-
getBookName
Description copied from interface:SBookGet the book name, a book name is unique for book inSBookSeries- Returns:
- book name;
-
getSheet
Description copied from interface:SBookGet sheet at the index- Parameters:
i- the sheet index- Returns:
- the sheet at the index
-
getNumOfSheet
public int getNumOfSheet()Description copied from interface:SBookGet the number of sheet- Returns:
- the number of sheet
-
getSheetByName
Description copied from interface:SBookGet the sheet by name- Parameters:
name- the name of sheet- Returns:
- the sheet, or null if not found
-
getSheetById
Description copied from interface:SBookGet the sheet by id- Parameters:
id- the id of sheet- Returns:
- the sheet, or null if not found
-
checkOwnership
-
checkOwnership
-
startBatchNotificationMode
public void startBatchNotificationMode()Description copied from class:AbstractBookAdvStarts a batch mode for event notification in a workbook. Note: all the subsequence event will put in a queue or be ignored it if that event has a duplicated one already inside the queue, and then all the events are triggered untilAbstractBookAdv.stopBatchNotificationMode()is invoked.Usage:
try { book.startBatchNotificationMode(); // do something here to send events. } finally { book.stopBatchNotificationMode(); // ensure this will be invoked finally }- Specified by:
startBatchNotificationModein classAbstractBookAdv- See Also:
-
stopBatchNotificationMode
public void stopBatchNotificationMode()Description copied from class:AbstractBookAdvStops the batch mode for event notification when triggers all of the events in a queue.- Specified by:
stopBatchNotificationModein classAbstractBookAdv
-
sendModelEvent
- Specified by:
sendModelEventin classAbstractBookAdv
-
createSheet
Description copied from interface:SBookCreate a sheet- Parameters:
name- the name of sheet- Returns:
- the sheet
-
createSheet
Description copied from interface:SBookCreate 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
Description copied from interface:SBookCreate 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
-
getRef
-
setSheetName
Description copied from interface:SBookSet the sheet to a new name- Parameters:
sheet- the sheetnewname- the new name
-
deleteSheet
Description copied from interface:SBookDelete the sheet- Parameters:
sheet- the sheet
-
moveSheetTo
Description copied from interface:SBookMove the sheet to new position- Parameters:
sheet- the sheetindex- the new position
-
dump
-
getDefaultCellStyle
Description copied from interface:SBookGet the default style of this book- Returns:
-
getDefaultCellStyle
Description copied from interface:SBookGet the nth default style of this book- Returns:
-
getDefaultImmutableCellStyle
-
geImmutableCellStyleTable
-
getDefaultImmutableCellStyle
-
setDefaultCellStyle
Description copied from interface:SBookSet the default style of this book -
createCellStyle
Description copied from interface:SBookCreate a cell style- Parameters:
inStyleTable- if true, the new created style will be stored inside this book, then you can useSBook.searchCellStyle(CellStyleMatcher)to search and reuse this style.
-
createCellStyle
Description copied from interface:SBookCreate 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 useSBook.searchCellStyle(CellStyleMatcher)to search and reuse this style.
-
addCellStyle
Description copied from interface:SBookCreate a cell style builder with default font and store inside this book after built, then you can useSBook.getOrAddCellStyle(SCellStyle)to find and reuse this style. -
addCellStyle
Description copied from interface:SBookCreate a cell style builder and copy the style from the src style, store inside this book after built, then you can useSBook.getOrAddCellStyle(SCellStyle)to find and reuse this style.- Parameters:
src- the source style to copy from.
-
createCellStyle
Description copied from interface:SBookCreate a cell style builder with default font -
createCellStyle
Description copied from interface:SBookCreate 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.
-
getCellStyleTable
-
searchCellStyle
Description copied from interface:SBookSearch the style table and return the first matched style.- Parameters:
matcher- the style matcher- Returns:
- the matched style.
-
addExtraStyle
Description copied from interface:SBookAdd one more extra cell style. -
getExtraStyles
Description copied from interface:SBookGet all extra styles. -
clearExtraStyles
public void clearExtraStyles()- Specified by:
clearExtraStylesin classAbstractBookAdv
-
searchExtraStyle
Description copied from interface:SBookSearch the style table and return the first matched style.- Parameters:
matcher- the style matcher- Returns:
- the matched style.
-
getDefaultFont
-
getDefaultImmutableFont
-
geImmutableFontTable
-
addFont
Description copied from interface:SBookCreate a font builder and store inside this book after built, then you can useSBook.searchFont(FontMatcher)to search and reuse this style. -
addFont
Description copied from interface:SBookCreate a font builder and copy the style from the src style, store inside this book after built, then you can useSBook.searchFont(FontMatcher)to search and reuse this style. -
createFont
Description copied from interface:SBookCreate a font builder without storing inside this book after built. -
createFont
Description copied from interface:SBookCreate a font builder and copy the style from the src style, store inside this book after built, then you can useSBook.searchFont(FontMatcher)to search and reuse this style.- Parameters:
src- the source style to copy from.
-
getOrAddFont
Description copied from class:AbstractBookAdvGet the font which stored in this book, or add it into the book if not found, then you can useSBook.searchFont(FontMatcher)to search and reuse this style.- Specified by:
getOrAddFontin classAbstractBookAdv
-
createFont
-
createFont
-
searchFont
-
getMaxRowSize
public int getMaxRowSize()Description copied from interface:SBookGet the max row size of this book -
getMaxColumnSize
public int getMaxColumnSize()Description copied from interface:SBookGet the max column size of this book -
optimizeCellStyle
public void optimizeCellStyle()Description copied from interface:SBookOptimize CellStyle, usually called when export book or after many style operation -
getFontTable
-
addEventListener
Description copied from interface:SBookadd event listener to this book- Parameters:
listener- the listener
-
removeEventListener
Description copied from interface:SBookremove event listener from this book- Parameters:
listener- the listener
-
getAttribute
Description copied from interface:SBookGet the runtime custom attribute that stored in this book- Parameters:
name- the attribute name- Returns:
- the value, or null if not found
-
setAttribute
Description copied from interface:SBookSet 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
Description copied from interface:SBookGet the unmodifiable runtime attributes map- Returns:
-
createColor
-
createColor
-
getSheets
Description copied from interface:SBookGet all sheets- Returns:
- an unmodifiable sheet list
-
createName
-
createName
Description copied from interface:SBookCreate a defined name on specified sheet- Returns:
- created defined name
-
setNameName
-
setNameName
-
deleteName
Description copied from interface:SBookDelete a defined name -
getNumOfName
public int getNumOfName() -
getName
-
getNameByName
-
getNameByName
-
getNames
-
getSheetIndex
Description copied from interface:SBookGet the index of sheet- Parameters:
sheet- the sheet- Returns:
- the index
-
getSheetIndex
Description copied from interface:SBookGet the index of sheet- Parameters:
sheetName- the sheet
-
getEvaluationContributor
-
setEvaluationContributor
-
getMaxRowIndex
public int getMaxRowIndex()Description copied from interface:SBookGet the max row index of this book, it isSBook.getMaxRowSize()-1 -
getMaxColumnIndex
public int getMaxColumnIndex()Description copied from interface:SBookGet the max column index of this book, it isSBook.getMaxColumnIndex()-1 -
getId
- Specified by:
getIdin classAbstractBookAdv
-
addPictureData
Description copied from interface:SBookAddSPictureDatainto this book- Parameters:
format- picture formatdata- picture raw data- Returns:
- the created SPictureData
-
getPictureData
Description copied from interface:SBookGetSPictureDataof the specified index from this book; null if not exist- Returns:
- SPictureData of the specified index from this book; null if not exist
-
getPicturesDatas
Description copied from interface:SBookReturns allSPictureDatafo this book. -
getNamedStyle
Description copied from interface:SBookGet the named style of this book- Returns:
-
addDefaultCellStyle
Description copied from interface:SBookAdd one more default cell style and return its index. -
getDefaultCellStyles
Description copied from interface:SBookGet all default cell styles.- Returns:
-
addNamedCellstyle
Description copied from interface:SBookAdd one more named cell style. -
getNamedStyles
Description copied from interface:SBookGet all name styles.- Returns:
-
clearDefaultCellStyles
public void clearDefaultCellStyles()- Specified by:
clearDefaultCellStylesin classAbstractBookAdv
-
clearNamedStyles
public void clearNamedStyles()- Specified by:
clearNamedStylesin classAbstractBookAdv
-
isDirty
public boolean isDirty()Description copied from interface:SBookGet if book is changed- Returns:
- See Also:
-
#resetDirty()
-
setDirty
public void setDirty(boolean dirty) Description copied from interface:SBookSet dirty flag- See Also:
-
createTableName
- Specified by:
createTableNamein classAbstractBookAdv
-
addTable
- Specified by:
addTablein classAbstractBookAdv
-
getTable
- Specified by:
getTablein classAbstractBookAdv
-
removeTable
- Specified by:
removeTablein classAbstractBookAdv
-
setTableColumnName
- Specified by:
setTableColumnNamein classAbstractBookAdv
-
getOrCreateDefaultHyperlinkStyle
Description copied from interface:SBookReturns existing or create SCellStyle for hyperlink on the specified cell- Returns:
-
getOrAddDefaultHyperlinkStyle
Description copied from interface:SBookReturns existing or add cell style for hyperlink on the specified cell- Parameters:
cell- the cell with hyperlink
-
initDefaultFont
public void initDefaultFont()- Specified by:
initDefaultFontin classAbstractBookAdv
-
getCharWidth
public int getCharWidth()Office Open XML Part 4: Markup Language Reference 3.3.1.12 col (Column Width & Formatting) The character width 7 is based on Calibri 11 and character width 8 is base on Calibri 12.- Specified by:
getCharWidthin classAbstractBookAdv
-
getTableStyle
Description copied from interface:SBookGet table style of the specified name.- Returns:
-
addTableStyle
Description copied from interface:SBookAdd table style into this book. -
getTableStyles
Description copied from interface:SBookReturns table styles of this book.- Returns:
-
clearTableStyles
public void clearTableStyles()Description copied from interface:SBookClear custom table styles of this book. -
setDefaultPivotStyleName
Description copied from interface:SBookSet default pivot style name. -
getDefaultPivotStyleName
Description copied from interface:SBookGet default pivot style name.- Returns:
-
setDefaultTableStyleName
Description copied from interface:SBookSet default table style name -
getDefaultTableStyleName
Description copied from interface:SBookGet default table style name- Returns:
-
getDependencyTracer
Description copied from interface:SBookReturns the dependency tracer.- Returns:
-
getWorkbookProtection
Description copied from interface:SBookReturns the workbook protection -
setFormulaMaxIterations
public void setFormulaMaxIterations(int maxIterations) Description copied from interface:SBookSets the max iterations of formula -
getFormulaMaxIterations
public int getFormulaMaxIterations()Description copied from interface:SBookReturns the max iterations of formula -
setFormulaMaxChange
public void setFormulaMaxChange(double maxChange) Description copied from interface:SBookSets the max change of formula -
getFormulaMaxChange
public double getFormulaMaxChange()Description copied from interface:SBookReturns the max change of formula -
cloneBook
Description copied from interface:SBookClones a new book.- Returns:
- a new book
-
getOrAddCellStyle
Description copied from interface:SBookGet the cell style which stored in this book, add it into the book if not found. -
getCellStyle
-
getOrAddExtraStyle
Description copied from interface:SBookGet the extra style which stored in this book, add it into the book if not found. -
isPostProcessing
public boolean isPostProcessing()- Specified by:
isPostProcessingin classAbstractBookAdv
-
setPostProcessing
public void setPostProcessing(boolean b) - Specified by:
setPostProcessingin classAbstractBookAdv
-
hasSubtotalExpression
public boolean hasSubtotalExpression()- Specified by:
hasSubtotalExpressionin classAbstractBookAdv
-
resetSubtotalExpressionCache
public void resetSubtotalExpressionCache()- Specified by:
resetSubtotalExpressionCachein classAbstractBookAdv
-