Package io.keikai.model.impl
Class SheetImpl
java.lang.Object
io.keikai.model.impl.AbstractSheetAdv
io.keikai.model.impl.SheetImpl
- All Implemented Interfaces:
LinkedModelObject,SSheet,Serializable
- Since:
- 3.5.0
- Author:
- dennis
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.keikai.model.SSheet
SSheet.SheetVisible -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCellRegionValueChangeListener(CellRegion cellRegion, SerializableConsumer<CellRegion> listener) Adds the listener when specific cell region value change.addChart(SChart.ChartType type, ViewAnchor anchor) addChart(String name, SChart.ChartType type, ViewAnchor anchor) Add a chart with name, type and anchoraddConditionalFormatting(CellRegion srcrgn, CellRegion dstrgn, SConditionalFormatting src, int rowOff, int colOff) Paste from src a new ConditionalFormatting at the specified region.voidaddDataValidation(CellRegion region) addDataValidation(CellRegion region, SDataValidation src) voidaddDirectlyMergedRegion(CellRegion region) voidaddMergedRegion(CellRegion region) Add a merged area, you can't assign a area that overlaps existed merged area.addPicture(int picDataIndex, ViewAnchor anchor) Add a picture into the sheet with known picture data index.addPicture(SPicture.Format format, byte[] data, ViewAnchor anchor) Add a picture into this sheet with raw picture data and format.voidAdd a new tablecheckMergedRegion(CellRegion region) voidprotected voidcheckOwnership(SChart chart) protected voidcheckOwnership(SDataValidation validation) protected voidcheckOwnership(SPicture picture) voidClear auto filter if there is.voidclearCell(int rowIdx, int columnIdx, int rowIdx2, int columnIdx2) voidclearCell(CellRegion region) Clear cells in specified regionvoidcreateAutoFilter(CellRegion region) Creates a new auto filter, the old one will be drop directly.voidDelete current autofilter if it hasvoiddeleteCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, boolean horizontal) voiddeleteCell(CellRegion region, boolean horizontal) Delete a region of cells and shift existing cells.voiddeleteChart(SChart chart) voiddeleteColumn(int columnIdx, int lastColumnIdx) delete columns specified by first and last indexvoidDelete a conditional formatting from this sheet.Delete a region from conditional formatting and return the deleted conditional formatting.voiddeleteDataValidation(SDataValidation validationid) deleteDataValidationRegion(CellRegion region) Delete data validations that are covered by the specified region.voiddeletePicture(SPicture picture) voiddeleteRow(int rowIdx, int lastRowIdx) delete rows specified by first and last indexvoiddestroy()Destroy / release this model object, for example all the dependency, parent linking.voiddump(StringBuilder builder) Returns all cell regions of array formula in the given sheetgetAttribute(String name) Get the runtime custom attribute that stored in this sheetGet the unmodifiable runtime attributes mapGets the auto filter information if there is.getBook()Get the owner bookgetCell(int rowIdx, int columnIdx) This method always returns not-null cell object.getCellIterator(int row) Returns the cell regin if the given cell is in an array formula.getChart(int idx) getChartByName(String name) Returns the first chart with specific namegetChartsByName(String name) Returns the charts with specific namegetColumn(int columnIdx) getColumnArray(int columnIdx) getConditionalFormatting(int id) getConditionalFormatting(int row, int col) Returns the conditional formatting applied to this sheet.getConditionalFormattingStyle(int row, int col) getContainsMergedRegions(CellRegion region) Get the merged region that are contained by region.Returns the region which contains data(including chart, picture, and fills) in this sheet; return null if empty sheet.getDataValidation(int idx) getDataValidation(int rowIdx, int columnIdx) getDataValidation(String validationid) intintintgetEndCellIndex(int rowIdx) intintshortInternal Use only.getId()getMergedRegion(int idx) getMergedRegion(int row, int column) getMergedRegion(String cellRef) intintintintintintReturns the maximum outline level for column represent.intReturns the maximum outline level for row represent.getOverlapsMergedRegions(CellRegion region, boolean excludeContains) Get the merged region that overlapped the regiongetPicture(int idx) getPicture(String picid) getRow(int rowIdx) getRowIterator(boolean reverse, int start, int end) getRowIterator(int start, int end) Get the sheet nameGets enhanced protection.Get the sheet current visible state.intgetStartCellIndex(int rowIdx) intintgetTableByRowCol(int rowIdx, int colIdx) Get tables in this sheetvoidinsertCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, boolean horizontal) voidinsertCell(CellRegion region, boolean horizontal) Insert a region of cells and shift existing cells.voidinsertColumn(int columnIdx, int lastColumnIdx) insert columns specified by first and last indexvoidinsertRow(int rowIdx, int lastRowIdx) insert rows specified by first and last indexbooleanReturns whether to apply the styles in outline.booleanbooleanisHidden(int rowIdx, int colIdx) booleanCheck if the sheet is protectedbooleanisRowHidden(int rowIdx) booleanReturns whether to display outline symbols.booleanReturns whether to display summary below in outline for rows.booleanReturns whether to display summary right in outline for columns.voidmoveCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, int rowOffset, int columnOffset) Move a region of cells specified by 4 indexes.voidmoveCell(CellRegion region, int rowOffset, int columnOffset) Move one or more cells.intpasteCell(SheetRegion src, CellRegion dest, PasteOption option) paste cell from src sheet to this sheet, the sheets must in same bookremoveArrayFormula(SCell cell) Remove an Array Formula from this sheet.booleanremoveCellRegionValueChangeListener(CellRegion cellRegion) Remove all cell region value change listeners of specific cell region.booleanRemove the cell region value change listener.voidvoidRemove a region from conditional formatting.voidremoveMergedRegion(CellRegion region, boolean removeOverlaps) Remove the merged area that are contained by regionvoidremoveTable(STable table) voidremoveTable(String name) Remove the table of the specified table name.voidremoveTables(Set<String> tableNames) voidsetAlgName(String algName) New way of hashing sheet protection password.voidsetApplyStyles(boolean applyStyles) Sets to apply with the styles in outline.setArrayFormula(String formula, CellRegion region) Sets array formula to specified region for result.setAttribute(String name, Object value) Set the runtime custom attribute to stored in this sheet, the attribute is only use for developer to stored runtime data in the sheet, values will not stored to excel when exporting.voidsetDefaultColumnWidth(int width) set default column width in pixelsvoidsetDefaultRowHeight(int height) set default row height in pixelsvoidsetHashedPassword(short hashpass) Internal User only.voidsetHashValue(String hashValue) New way of hashing sheet protection password.voidsetMergeOutOfSync(int state) voidsetOutlineLevelCol(int outlineLevelCol) Sets the maximum outline level for column represent of this sheet.voidsetOutlineLevelRow(int outlineLevelRow) Sets the maximum outline level for row represent of this sheet.voidsetPassword(String password) Sets password to protect sheet, set null to unprotect it.voidsetSaltValue(String saltValue) New way of hashing sheet protection password.voidSet the sheet current visible state.voidsetShowOutlineSymbols(boolean showOutlineSymbols) Sets whether to display outline symbols.voidsetSpinCount(String spinCount) New way of hashing sheet protection password.voidsetSummaryBelow(boolean summaryBelow) Sets to display summary below in outline for rows.voidsetSummaryRight(boolean summaryRight) Sets whether to display summary right in outline for columns.voidsetTabColor(String tabColor) Set sheet tab colorsetupColumnArray(int index, int lastIndex) Set up a column array, if one array range overlaps another, it throws IllegalStateException.voidvoid
-
Constructor Details
-
SheetImpl
-
-
Method Details
-
checkOwnership
-
checkOwnership
-
checkOwnership
-
getBook
Description copied from interface:SSheetGet the owner book- Returns:
- the owner book
-
getSheetName
Description copied from interface:SSheetGet the sheet name- Returns:
- the sheet name
-
getRow
-
getColumn
-
getColumnArray
- See Also:
-
setupColumnArray
Description copied from interface:SSheetSet up a column array, if one array range overlaps another, it throws IllegalStateException. If you setup a column array that is not continuous, (for example, 0~2, 5~6), then it will create a missing column array automatically to make them continuous.(3~4 in the example). It's required to set up in ascending order of starting column index (min), or it will create unexpectedSColumnArrayfor columns are not continuous.- Parameters:
index- index of the starting columnlastIndex- index of the end column- Returns:
- the new created column array
-
getCell
Description copied from interface:SSheetThis method always returns not-null cell object. UseSCell.isNull()to know it's null (blank) or not. -
getCell
- Returns:
- return a cell with specified cell reference, e.g. A2, B3. Area reference, A1:A2, is not acceptable.
- See Also:
-
getStartRowIndex
public int getStartRowIndex() -
getEndRowIndex
public int getEndRowIndex() -
getStartColumnIndex
public int getStartColumnIndex() -
getEndColumnIndex
public int getEndColumnIndex() -
getStartCellIndex
public int getStartCellIndex(int rowIdx) -
getEndCellIndex
public int getEndCellIndex(int rowIdx) -
clearCell
Description copied from interface:SSheetClear cells in specified region -
clearCell
public void clearCell(int rowIdx, int columnIdx, int rowIdx2, int columnIdx2) - See Also:
-
insertRow
public void insertRow(int rowIdx, int lastRowIdx) Description copied from interface:SSheetinsert rows specified by first and last index -
deleteRow
public void deleteRow(int rowIdx, int lastRowIdx) Description copied from interface:SSheetdelete rows specified by first and last index -
insertCell
Description copied from interface:SSheetInsert a region of cells and shift existing cells.- Parameters:
region- the region of cells to inserthorizontal- TRUE for shifting right, FALSE for shifting down
-
insertCell
public void insertCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, boolean horizontal) - See Also:
-
deleteCell
Description copied from interface:SSheetDelete a region of cells and shift existing cells.- Parameters:
region- the region of cells to deletehorizontal- TRUE for shifting left, FALSE for shifting up
-
deleteCell
public void deleteCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, boolean horizontal) - See Also:
-
dump
-
insertColumn
public void insertColumn(int columnIdx, int lastColumnIdx) Description copied from interface:SSheetinsert columns specified by first and last index -
deleteColumn
public void deleteColumn(int columnIdx, int lastColumnIdx) Description copied from interface:SSheetdelete columns specified by first and last index -
moveCell
Description copied from interface:SSheetMove one or more cells.- Parameters:
region- the region of cells to moverowOffset- positive number to move down, negative to move upcolumnOffset- positive number to move right, negative to move left
-
moveCell
public void moveCell(int rowIdx, int columnIdx, int lastRowIdx, int lastColumnIdx, int rowOffset, int columnOffset) Description copied from interface:SSheetMove a region of cells specified by 4 indexes.- See Also:
-
checkOrphan
public void checkOrphan() -
destroy
public void destroy()Description copied from interface:LinkedModelObjectDestroy / release this model object, for example all the dependency, parent linking. this method has to be called before remove this linking from parent object -
getId
- Returns:
- interal sheet object ID
-
addPicture
Description copied from interface:SSheetAdd a picture into this sheet with raw picture data and format.- Parameters:
format- picture format as specified inSPicture.Formatdata- raw byte data of the pictureanchor- where to anchor this picture- Returns:
- the added
SPicture
-
addPicture
Description copied from interface:SSheetAdd a picture into the sheet with known picture data index.- Parameters:
picDataIndex-SPictureDataindexanchor- where to anchor this picture- Returns:
- the
SPictureadded
-
getPicture
-
deletePicture
-
getPictures
-
getNumOfPicture
public int getNumOfPicture() -
getPicture
-
addChart
-
addChart
Description copied from interface:SSheetAdd a chart with name, type and anchor- Returns:
- the created chart
-
getChartByName
Description copied from interface:SSheetReturns the first chart with specific name- Returns:
- the chart with specific name
-
getChartsByName
Description copied from interface:SSheetReturns the charts with specific name- Returns:
- the charts with specific name
-
getChart
-
deleteChart
-
getCharts
-
getNumOfChart
public int getNumOfChart() -
getChart
-
getMergedRegions
-
removeMergedRegion
Description copied from interface:SSheetRemove the merged area that are contained by regionremoveOverlaps- true if you want to remove the merged areas that are just overlapped.
-
addMergedRegion
Description copied from interface:SSheetAdd a merged area, you can't assign a area that overlaps existed merged area. -
getOverlapsMergedRegions
Description copied from interface:SSheetGet the merged region that overlapped the region- Returns:
- the regions that overlaps
-
getContainsMergedRegions
Description copied from interface:SSheetGet the merged region that are contained by region.- Returns:
- the regions that are contained
-
getMergedRegion
-
getMergedRegion
-
getAttribute
Description copied from interface:SSheetGet the runtime custom attribute that stored in this sheet- Parameters:
name- the attribute name- Returns:
- the value, or null if not found
-
setAttribute
Description copied from interface:SSheetSet the runtime custom attribute to stored in this sheet, the attribute is only use for developer to stored runtime data in the sheet, values will not stored to excel when exporting.- Parameters:
name- name the attribute namevalue- the attribute value
-
getAttributes
Description copied from interface:SSheetGet the unmodifiable runtime attributes map- Returns:
-
getRowIterator
- Returns:
- an iterator of existing rows excluding those blank rows
-
getRowIterator
- Parameters:
start- the start indexend- the end index- Returns:
- an iterator of existing rows excluding those blank rows
-
getRowIterator
- Specified by:
getRowIteratorin classAbstractSheetAdv
-
getColumnArrayIterator
-
getColumnIterator
- Returns:
- an iterator of existing columns excluding those blank columns
-
getCellIterator
-
getDefaultRowHeight
public int getDefaultRowHeight()- Returns:
- default row height in pixels
-
getDefaultColumnWidth
public int getDefaultColumnWidth()- Returns:
- default column width in pixels
-
setDefaultRowHeight
public void setDefaultRowHeight(int height) Description copied from interface:SSheetset default row height in pixels -
setDefaultColumnWidth
public void setDefaultColumnWidth(int width) Description copied from interface:SSheetset default column width in pixels -
getNumOfMergedRegion
public int getNumOfMergedRegion() -
getMergedRegion
-
isProtected
public boolean isProtected()Description copied from interface:SSheetCheck if the sheet is protected- Returns:
-
setTabColor
Description copied from interface:SSheetSet sheet tab color -
getTabColor
- Returns:
- sheet tab color
-
setPassword
Description copied from interface:SSheetSets password to protect sheet, set null to unprotect it. -
getHashedPassword
public short getHashedPassword()Description copied from interface:SSheetInternal Use only.- Returns:
-
getViewInfo
-
getPrintSetup
-
addDataValidation
-
addDataValidation
-
getDataValidation
-
deleteDataValidation
-
deleteDataValidationRegion
Description copied from interface:SSheetDelete data validations that are covered by the specified region.- Parameters:
region- the cover region- Returns:
- the data validations deleted
-
getDataValidations
-
getNumOfDataValidation
public int getNumOfDataValidation() -
getDataValidation
-
getDataValidation
- Returns:
- the first data validation at row, column
-
getAutoFilter
Description copied from interface:SSheetGets the auto filter information if there is.- Returns:
- the auto filter, or null if not found
-
createAutoFilter
Description copied from interface:SSheetCreates a new auto filter, the old one will be drop directly.- Parameters:
region- the auto filter region- Returns:
- the new auto filter.
-
deleteAutoFilter
public void deleteAutoFilter()Description copied from interface:SSheetDelete current autofilter if it has -
clearAutoFilter
public void clearAutoFilter()Description copied from interface:SSheetClear auto filter if there is. -
pasteCell
Description copied from interface:SSheetpaste cell from src sheet to this sheet, the sheets must in same book- Parameters:
src- src sheet and it's region to pastedest- destination region in this sheetoption- the copy option- Returns:
- the final effected region
-
getSheetProtection
Description copied from interface:SSheetGets enhanced protection. -
setHashedPassword
public void setHashedPassword(short hashpass) Description copied from interface:SSheetInternal User only. -
getSheetVisible
Description copied from interface:SSheetGet the sheet current visible state. -
setSheetVisible
Description copied from interface:SSheetSet the sheet current visible state. -
addTable
Description copied from interface:SSheetAdd a new table -
getTables
Description copied from interface:SSheetGet tables in this sheet- Returns:
-
removeTable
Description copied from interface:SSheetRemove the table of the specified table name. -
getTableByRowCol
- Specified by:
getTableByRowColin classAbstractSheetAdv
-
isHidden
public boolean isHidden(int rowIdx, int colIdx) - Specified by:
isHiddenin classAbstractSheetAdv
-
isRowHidden
public boolean isRowHidden(int rowIdx) - Specified by:
isRowHiddenin classAbstractSheetAdv
-
isFiltered
public boolean isFiltered()- Specified by:
isFilteredin classAbstractSheetAdv
-
removeTables
- Specified by:
removeTablesin classAbstractSheetAdv
-
removeTable
- Specified by:
removeTablein classAbstractSheetAdv
-
clearTables
public void clearTables()- Specified by:
clearTablesin classAbstractSheetAdv
-
setHashValue
Description copied from interface:SSheetNew way of hashing sheet protection password. -
getHashValue
-
setSpinCount
Description copied from interface:SSheetNew way of hashing sheet protection password. -
getSpinCount
-
setSaltValue
Description copied from interface:SSheetNew way of hashing sheet protection password. -
getSaltValue
-
setAlgName
Description copied from interface:SSheetNew way of hashing sheet protection password. -
getAlgName
-
checkMergedRegion
-
addDirectlyMergedRegion
-
getConditionalFormattings
Description copied from interface:SSheetReturns the conditional formatting applied to this sheet.- Returns:
-
getSheetConditionalFormattings
- Specified by:
getSheetConditionalFormattingsin classAbstractSheetAdv
-
addConditionalFormatting
- Specified by:
addConditionalFormattingin classAbstractSheetAdv
-
setMergeOutOfSync
public void setMergeOutOfSync(int state) - Specified by:
setMergeOutOfSyncin classAbstractSheetAdv
-
getMergeOutOfSync
public int getMergeOutOfSync()- Specified by:
getMergeOutOfSyncin classAbstractSheetAdv
-
getDataRegion
Description copied from interface:SSheetReturns the region which contains data(including chart, picture, and fills) in this sheet; return null if empty sheet.- Returns:
- the region which contains data(including chart, picture, and fills) in this sheet; return null if empty sheet.
-
getConditionalFormattingStyle
- Specified by:
getConditionalFormattingStylein classAbstractSheetAdv
-
removeConditionalFormatting
- Specified by:
removeConditionalFormattingin classAbstractSheetAdv
-
addConditionalFormatting
public SConditionalFormatting addConditionalFormatting(CellRegion srcrgn, CellRegion dstrgn, SConditionalFormatting src, int rowOff, int colOff) Description copied from class:AbstractSheetAdvPaste from src a new ConditionalFormatting at the specified region.- Specified by:
addConditionalFormattingin classAbstractSheetAdv- Returns:
-
nextConditionalId
public int nextConditionalId()- Specified by:
nextConditionalIdin classAbstractSheetAdv
-
getConditionalFormatting
- Specified by:
getConditionalFormattingin classAbstractSheetAdv
-
getConditionalFormatting
- Specified by:
getConditionalFormattingin classAbstractSheetAdv- Returns:
- the associated conditionalFormattingRule
-
deleteConditionalFormatting
Description copied from class:AbstractSheetAdvDelete a conditional formatting from this sheet.- Specified by:
deleteConditionalFormattingin classAbstractSheetAdv
-
removeConditionalFormattingRegion
Description copied from class:AbstractSheetAdvRemove a region from conditional formatting.- Specified by:
removeConditionalFormattingRegionin classAbstractSheetAdv
-
deleteConditionalFormattingRegion
Description copied from class:AbstractSheetAdvDelete a region from conditional formatting and return the deleted conditional formatting.- Specified by:
deleteConditionalFormattingRegionin classAbstractSheetAdv- Returns:
-
setArrayFormula
Description copied from interface:SSheetSets array formula to specified region for result.Note if there are shared formulas this will invalidate any
FormulaEvaluatorinstances based on this workbook- Parameters:
formula- text representation of the formularegion- Region of array formula for result.- Returns:
- the
CellRegionof cells affected by this change
-
removeArrayFormula
Description copied from interface:SSheetRemove an Array Formula from this sheet. All cells contained in the Array Formula range are removed as well- Parameters:
cell- any cell within Array Formula range- Returns:
- the
CellRegionof cells affected by this change
-
getCellRegionInArrayFormula
Description copied from interface:SSheetReturns the cell regin if the given cell is in an array formula. -
getAllArrayFormulas
Description copied from interface:SSheetReturns all cell regions of array formula in the given sheet- Specified by:
getAllArrayFormulasin interfaceSSheet- Specified by:
getAllArrayFormulasin classAbstractSheetAdv
-
setOutlineLevelRow
public void setOutlineLevelRow(int outlineLevelRow) Description copied from interface:SSheetSets the maximum outline level for row represent of this sheet. -
getOutlineLevelRow
public int getOutlineLevelRow()Description copied from interface:SSheetReturns the maximum outline level for row represent. -
setOutlineLevelCol
public void setOutlineLevelCol(int outlineLevelCol) Description copied from interface:SSheetSets the maximum outline level for column represent of this sheet. -
getOutlineLevelCol
public int getOutlineLevelCol()Description copied from interface:SSheetReturns the maximum outline level for column represent. -
isApplyStyles
public boolean isApplyStyles()Description copied from interface:SSheetReturns whether to apply the styles in outline.Default:
false -
setApplyStyles
public void setApplyStyles(boolean applyStyles) Description copied from interface:SSheetSets to apply with the styles in outline.Note: Only used for maintaining model state. (not implemented for UI parts)
- Parameters:
applyStyles- false not to apply
-
isSummaryBelow
public boolean isSummaryBelow()Description copied from interface:SSheetReturns whether to display summary below in outline for rows.Default:
true -
setSummaryBelow
public void setSummaryBelow(boolean summaryBelow) Description copied from interface:SSheetSets to display summary below in outline for rows.Default:
true- Parameters:
summaryBelow- false to display on top.
-
isSummaryRight
public boolean isSummaryRight()Description copied from interface:SSheetReturns whether to display summary right in outline for columns.Default:
true -
setSummaryRight
public void setSummaryRight(boolean summaryRight) Description copied from interface:SSheetSets whether to display summary right in outline for columns.Default:
true- Parameters:
summaryRight- false to display on left.
-
isShowOutlineSymbols
public boolean isShowOutlineSymbols()Description copied from interface:SSheetReturns whether to display outline symbols.Default:
true -
setShowOutlineSymbols
public void setShowOutlineSymbols(boolean showOutlineSymbols) Description copied from interface:SSheetSets whether to display outline symbols.Default:
true- Parameters:
showOutlineSymbols- false not to show.
-
syncOutlineLevelRowTree
public void syncOutlineLevelRowTree() -
syncOutlineLevelColTree
public void syncOutlineLevelColTree() -
getOutlineLevelRowTree
-
getOutlineLevelColTree
-
addCellRegionValueChangeListener
public void addCellRegionValueChangeListener(CellRegion cellRegion, SerializableConsumer<CellRegion> listener) Description copied from interface:SSheetAdds the listener when specific cell region value change. -
removeCellRegionValueChangeListener
Description copied from interface:SSheetRemove all cell region value change listeners of specific cell region.- Returns:
- whether the listeners are removed successfully.
-
removeCellRegionValueChangeListener
Description copied from interface:SSheetRemove the cell region value change listener.- Returns:
- whether the listener is removed successfully.
-