Package io.keikai.api.impl
Class RangeImpl
- java.lang.Object
-
- io.keikai.api.impl.RangeImpl
-
- All Implemented Interfaces:
Range
,Serializable
public class RangeImpl extends Object implements Range, Serializable
1.Range does not handle the protection issue. By callingisSheetProtected()
andgetSheetProtection()
, you can handle it easily.- Since:
- 3.0.0
- Author:
- dennis
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.keikai.api.Range
Range.ApplyBorderType, Range.AutoFillType, Range.AutoFilterOperation, Range.CellAttribute, Range.CellStyleHelper, Range.DeleteShift, Range.InsertCopyOrigin, Range.InsertShift, Range.PasteOperation, Range.PasteType, Range.SheetVisible, Range.SortDataOption
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Chart
addChart(SheetAnchor anchor, Chart.Type type, Chart.Grouping grouping, Chart.LegendPosition pos)
Adds chart to sheetPicture
addPicture(SheetAnchor anchor, byte[] image, Picture.Format format)
Adds picture to sheetvoid
applyAutoFilter()
re-apply existing criteria of filtersvoid
applyBorders(Range.ApplyBorderType type, CellStyle.BorderType borderType, String htmlColor)
apply bordersvoid
applyBordersAround(CellStyle.BorderType borderType, String htmlColor)
String
asString()
get formatted string of this rangevoid
autoFill(Range dest, Range.AutoFillType fillType)
According to current range, fills data to destination range automaticallyvoid
clearAll()
Clears contents, styles and unmerge this range.void
clearContents()
Clears contentsvoid
clearOutlineLevel()
Clears all outline level for all groups that intersect with the range.void
clearStyles()
Clears stylesvoid
clearTrace()
Clears the current tracing.Sheet
cloneSheet(String name)
Clone this sheet; create a sheet and copy the contents of this sheet; then add it as the last sheet.Sheet
cloneSheetFrom(String name, Sheet sheet)
Clone from the specified source sheet to the owner book of this range.Sheet
cloneSheetFrom(String name, Sheet sheet, boolean valueOnly)
Clone from the specified source sheet to the owner book of this range.void
collapse()
Collapses one group by matching with the range at a time (not affected its descendant).void
createName(String nameName)
Create a name that refers to this range.Sheet
createSheet(String name)
Creates a new sheet and appends it as the last sheet.void
delete(Range.DeleteShift shift)
Delete cells of the range.void
deleteChart(Chart chart)
Deletes chartvoid
deletePicture(Picture picture)
Deletes picture that in sheetvoid
deleteSheet()
Deletes sheet.void
deleteValidation()
Delete theValidation
associated in the specified range.void
enableAutoFilter(boolean enable)
enable/disable autofilter of the sheetvoid
enableAutoFilter(int field, Range.AutoFilterOperation filterOp, Object criteria1, Object criteria2, Boolean showButton)
enable filter with conditionboolean
equals(Object obj)
void
expand()
Expands one group by matching with the range at a time (not affected its descendant).void
fillDown()
Fills cells by copying from first/top row datavoid
fillLeft()
Fills cells by copying from last/right column datavoid
fillRight()
Fills cells by copying from first/left column datavoid
fillUp()
Fills cells by copying from bottom row dataRange
findAutoFilterRange()
To find a range of cells for applying auto filter according to this range.Book
getBook()
Gets the book of this rangeCellData
getCellData()
Gets the first cell(top-left) data of this rangeString
getCellDataFormat()
Gets the first cell(top-left) format of this rangeString
getCellEditText()
Gets the first cell(top-left) edit text of this rangeString
getCellFormatText()
Gets the first cell(top-left) formatted text of this rangeHyperlink
getCellHyperlink()
Gets the first cell(top-left)Hyperlink
object of this range.String
getCellRichText()
Returns text in html format; null if not a rich text.CellStyle
getCellStyle()
get the first cell style of this rangeRange.CellStyleHelper
getCellStyleHelper()
Gets cell-style-helper, this helper helps you to create new style, font or colorObject
getCellValue()
Gets the first cell(top-left) value of this rangeList<Object>
getCellValues()
Gets all cell values from left to right and top to bottom of this range in one dimensional list.int
getColumn()
Gets the left column of this rangeint
getColumnCount()
Gets the column count of this rangeList<Range>
getColumnGroups()
Returns all group ranges for columns, which intersect with this range.List<Range>
getColumnGroups(int outlineLevel)
Returns all group ranges matched the given outline level for columns, which intersect with this range.List<Range>
getColumnGroups(int fromOutlineLevel, int toOutlineLevel)
Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for columns, which intersect with this range.String
getCommentRichText()
Return the comment rich edit text of the left top cell of this Range.CellRegion
getDataRegion()
Returns the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.Set<Range>
getDependents()
Returns all Range(s) that are the direct or indirect dependents of this cell Range.Set<Range>
getDirectDependents()
Returns Range(s) that are the direct dependents of this cell Range.Set<Range>
getDirectPrecedents()
Returns Range(s) that are the direct precedents of this cell Range.SRange
getInternalRange()
Get internal range implementationint
getLastColumn()
Gets the right/last column of this rangeint
getLastRow()
Gets the bottom/last row of this rangeRangeImpl
getLeftTop()
get the top-left cell range of this rangeReadWriteLock
getLock()
CellRegion
getMergedRegion()
Returns the merged region of the left top cell of this Range if any; otherwise, returns null if not a merged region.SRange
getNative()
Font
getOrCreateFont(Font.Boldweight boldweight, Color color, int fontHeight, String fontName, boolean italic, boolean strikeout, Font.TypeOffset typeOffset, Font.Underline underline)
Get font if exists or create font if not exists from the book of this range and return it.int
getOutlineLevel()
Returns the outline of the group by matching with the range.Set<Range>
getPrecedents()
Returns all Range(s) that are the direct or indirect precedents of this cell Range.int
getRow()
Gets the top row of this rangeint
getRowCount()
Gets the row count of this rangeList<Range>
getRowGroups()
Returns all group ranges for rows, which intersect with this range.List<Range>
getRowGroups(int outlineLevel)
Returns all group ranges matched the given outline level for rows, which intersect with this range.List<Range>
getRowGroups(int fromOutlineLevel, int toOutlineLevel)
Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for rows, which intersect with this range.Sheet
getSheet()
Gets the sheet of this rangeString
getSheetName()
Gets the sheet nameint
getSheetOrder()
Gets the sheet orderSheetProtection
getSheetProtection()
GetsSheetProtection
which tells what are allowed operations for a protected sheet of this range.List<Validation>
getValidations()
Gets read-onlyValidation
associated with the left-top cell of this range; return null if no associated validation.void
group()
Groups the rows or columns by matching the range, which increases their outline level.int
hashCode()
boolean
hasMergedCell()
void
insert(Range.InsertShift shift, Range.InsertCopyOrigin copyOrigin)
Insert new cells to the area of this range.
To insert a row, you have to callRange.toRowRange()
first, to insert a column, you have to callRange.toColumnRange()
first.boolean
isAnyCellProtected()
boolean
isAutoFilterEnabled()
check if auto filter is enable or not.boolean
isCollapsed()
Returns whether the group by matching with the range has collapsed or not.boolean
isCommentVisible()
Returns whether the comment is always visible at the left top cell of this range; if no comment at the cell, it returns false.boolean
isDisplaySheetGridlines()
boolean
isMergedCell()
boolean
isProtected()
boolean
isSheetProtected()
boolean
isSummaryBelow()
Returns whether to display group summary as below for rows.boolean
isSummaryRight()
Returns whether to display group summary as right for columns.boolean
isWholeColumn()
Check if this range represents a whole column, which mean all rows are included,boolean
isWholeRow()
Check if this range represents a whole row, which mean all column are included,boolean
isWholeSheet()
Check if this range represents a whole sheet, which mean all column and row are included,void
merge(boolean across)
Merges the rangevoid
moveChart(SheetAnchor anchor, Chart chart)
Moves chart to new locationvoid
movePicture(SheetAnchor anchor, Picture picture)
Moves pictureStream<Range>
nOrderStream()
Returns a n-order cell range stream which treats a merged cell as one range.void
notifyChange()
Notify this range has been changed, then spreadsheet will render the changed cells to a browser.void
notifyChange(Range.CellAttribute cellAttr)
Notify this range has been changed on the specifield attribute.void
notifyChange(String[] variables)
Notify the whole book of specified variables change.Range
paste(Range dest)
Pastes to destination.Range
paste(Range dest, boolean cut)
Cut and paste to destination.Range
pasteSpecial(Range dest, Range.PasteType type, Range.PasteOperation op, boolean skipBlanks, boolean transpose)
Pastes to destination.void
protectSheet(SheetProtection protection)
Protect aSheet
so that it cannot be modified.void
protectSheet(String password, boolean allowSelectingLockedCells, boolean allowSelectingUnlockedCells, boolean allowFormattingCells, boolean allowFormattingColumns, boolean allowFormattingRows, boolean allowInsertColumns, boolean allowInsertRows, boolean allowInsertingHyperlinks, boolean allowDeletingColumns, boolean allowDeletingRows, boolean allowSorting, boolean allowFiltering, boolean allowUsingPivotTables, boolean drawingObjects, boolean scenarios)
Protect aSheet
so that it cannot be modified.void
refresh(boolean includeDependants)
Enforce evaluation(if not cached) and refresh UI of this range and its dependent cells if the includeDependents is true.void
refresh(boolean includeDependants, boolean clearCache, boolean enforceEval)
Update data model and refresh UI of this range and its dependent cells if the argument includeDependents is true.void
resetAutoFilter()
clear criteria of all filters, show all the datavoid
setArrayFormula(String editText)
Works like a user entering an array formula in a cell or a range via a browser.boolean
setAutoRefresh(boolean auto)
Turn on(true)/off(false) of auto refresh of this range and return previous on/off status; default is true.void
setCellEditText(String editText)
Works like a user entering a text in a cell via a browser.void
setCellHyperlink(Hyperlink.HyperlinkType type, String address, String display)
Sets cell hyperlink, applies it too all cellsvoid
setCellRichText(String html)
Set into the left top cell of this Range the specified text in html format.void
setCellStyle(CellStyle nstyle)
Sets cell style, applies it to all cells of this rangevoid
setCellValue(Object value)
Sets cell data value and type.void
setCellValues(Object... values)
Sets cell data values, applies them to all cells from left to right and top to bottom consistently.void
setColumnWidth(int widthPx)
Sets the width(in pixel) of column in this range, it effect to whole column.void
setCommentRichText(String html)
Set comment rich text into the left top cell of this range; null to delete it.void
setCommentVisible(boolean visible)
Set comment visibility into the left top cell of this range; if no comment at the cell, it simply ignored.void
setDisplaySheetGridlines(boolean enable)
Displays sheet grid-lines or notvoid
setFreezePanel(int rowfreeze, int columnfreeze)
Set the freeze panelvoid
setHidden(boolean hidden)
Hide or unhide rows or columns.
To hide/unhide a row, you have to callRange.toRowRange()
first, to hide/un-hide a column, you have to callRange.toColumnRange()
or a whole column range.void
setNameName(String namename, String newname)
Set(Rename) the name of the Name(or Table) as specified in this Range(a Book or a Sheet).void
setRowHeight(int heightPx)
Sets the height(in pixel) of row in this range, it effect to whole row.void
setRowHeight(int heightPx, boolean isCustom)
Sets the height(in pixel) of row in this range and specify it's custom size or not.void
setSheetName(String name)
Sets the sheet namevoid
setSheetOrder(int pos)
Sets the sheet ordervoid
setSheetVisible(Range.SheetVisible visible)
Setup sheet's visibility; can be VISIBLE, HIDDEN, or VERY_HIDDEN.void
setStringValue(String text)
Save the specified value into this range as a String no matter the value is prefixed with '=' or not.void
setSummaryBelow(boolean summaryBelow)
Sets to be true to display summary group as below or to be false to display summary group as above for rows.void
setSummaryRight(boolean summaryRight)
Sets to be true to display summary group as right or to be false to display summary group as left for columns.void
setValidation(Validation.ValidationType validationType, boolean ignoreBlank, Validation.OperatorType operatorType, boolean inCellDropDown, String formula1, String formula2, boolean showInput, String inputTitle, String inputMessage, boolean showError, Validation.AlertStyle alertStyle, String errorTitle, String errorMessage)
Add if not exist or modify an existingValidation
to this range.void
shift(int rowOffset, int colOffset)
shift this range with a offset row and columnvoid
sort(boolean desc)
Sort rangevoid
sort(boolean desc, boolean hasHeader, boolean matchCase, boolean sortByRows, Range.SortDataOption dataOption)
Sort rangevoid
sort(Range key1, boolean desc1, Range.SortDataOption dataOption1, Range key2, boolean desc2, Range.SortDataOption dataOption2, Range key3, boolean desc3, Range.SortDataOption dataOption3, boolean header, boolean matchCase, boolean sortByRows)
Sort rangevoid
sync(RangeRunner run)
Runs runer under synchronization protectionRangeImpl
toCellRange(int rowOffset, int colOffset)
Returns a new range having one cell according to the offset based on the left-top corner.RangeImpl
toColumnRange()
Return a range that represents all rows and between the first-column and last-column of this rangeRangeImpl
toRowRange()
Return a range that represents all columns and between the first-row and last-row of this rangeRangeImpl
toShiftedRange(int rowOffset, int colOffset)
Return a new range by shifting the current Range according to the offsets but still keep the original height and width e.g.String
toString()
void
traceDependents()
Trace the dependents of this range.void
tracePrecedents()
Trace the precedents of this range.void
ungroup()
Ungroups the rows or columns by matching the range, which decreases their outline level.void
unmerge()
Unmerge the rangeboolean
unprotectSheet(String password)
Removes protection from a sheet.void
updateChart(Chart chart)
Notify the component that a chart has change, e.g.void
updateChart(Chart chart, SheetAnchor.AnchorType anchorType)
Notify the component that a chart has change, e.g.void
updatePicture(Picture picture, SheetAnchor.AnchorType anchorType)
Updates picture with anchor typeValidation
validate(String editText)
validate the user's input.void
visit(CellVisitor visitor)
visit all cells in this range, make sure you call this in a limited range, don't use it for all row/column selection, it will spend much time to iterate the cellStream<Range>
zOrderStream()
Returns a z-order cell range stream which treats a merged cell as one range.
-
-
-
Method Detail
-
getLock
public ReadWriteLock getLock()
-
getCellStyleHelper
public Range.CellStyleHelper getCellStyleHelper()
Description copied from interface:Range
Gets cell-style-helper, this helper helps you to create new style, font or color- Specified by:
getCellStyleHelper
in interfaceRange
- Returns:
-
getCellData
public CellData getCellData()
Description copied from interface:Range
Gets the first cell(top-left) data of this range- Specified by:
getCellData
in interfaceRange
- Returns:
-
getNative
public SRange getNative()
-
isProtected
public boolean isProtected()
- Specified by:
isProtected
in interfaceRange
- Returns:
- true if the specified range is protected; i.e. sheet is protected and some cells in the range are locked
-
isSheetProtected
public boolean isSheetProtected()
- Specified by:
isSheetProtected
in interfaceRange
- Returns:
- true if the sheet is protected
-
isAnyCellProtected
public boolean isAnyCellProtected()
-
paste
public Range paste(Range dest, boolean cut)
Description copied from interface:Range
Cut and paste to destination. Support pasting cells among 2 books.
-
paste
public Range paste(Range dest)
Description copied from interface:Range
Pastes to destination. Support pasting cells among 2 books.
-
pasteSpecial
public Range pasteSpecial(Range dest, Range.PasteType type, Range.PasteOperation op, boolean skipBlanks, boolean transpose)
Description copied from interface:Range
Pastes to destination. Support pasting cells among 2 books.- Specified by:
pasteSpecial
in interfaceRange
- Parameters:
dest
- the destination. It can be a range of a different book.type
- the paste typeop
- the paste operationskipBlanks
- skip blanks or nottranspose
- transpose the cell or not- Returns:
- a Range contains the final pasted range. paste to a protected sheet will always cause paste return null.
-
clearContents
public void clearContents()
Description copied from interface:Range
Clears contents- Specified by:
clearContents
in interfaceRange
-
clearAll
public void clearAll()
Description copied from interface:Range
Clears contents, styles and unmerge this range.
-
getSheet
public Sheet getSheet()
Description copied from interface:Range
Gets the sheet of this range
-
clearStyles
public void clearStyles()
Description copied from interface:Range
Clears styles- Specified by:
clearStyles
in interfaceRange
-
setCellStyle
public void setCellStyle(CellStyle nstyle)
Description copied from interface:Range
Sets cell style, applies it to all cells of this range- Specified by:
setCellStyle
in interfaceRange
- Parameters:
nstyle
- new cell style- See Also:
Range.getCellStyleHelper()
,Range.getCellStyle()
-
getColumn
public int getColumn()
Description copied from interface:Range
Gets the left column of this range
-
getRow
public int getRow()
Description copied from interface:Range
Gets the top row of this range
-
getLastColumn
public int getLastColumn()
Description copied from interface:Range
Gets the right/last column of this range- Specified by:
getLastColumn
in interfaceRange
- Returns:
-
getLastRow
public int getLastRow()
Description copied from interface:Range
Gets the bottom/last row of this range- Specified by:
getLastRow
in interfaceRange
- Returns:
-
sync
public void sync(RangeRunner run)
Description copied from interface:Range
Runs runer under synchronization protection
-
visit
public void visit(CellVisitor visitor)
visit all cells in this range, make sure you call this in a limited range, don't use it for all row/column selection, it will spend much time to iterate the cell
-
applyBordersAround
public void applyBordersAround(CellStyle.BorderType borderType, String htmlColor)
-
applyBorders
public void applyBorders(Range.ApplyBorderType type, CellStyle.BorderType borderType, String htmlColor)
Description copied from interface:Range
apply borders- Specified by:
applyBorders
in interfaceRange
- Parameters:
type
- the apply typeborderType
- the border typehtmlColor
- the color (#rgb-hex-code, e.x #FF00FF)
-
hasMergedCell
public boolean hasMergedCell()
- Specified by:
hasMergedCell
in interfaceRange
- Returns:
- true if any merged cell inside (fully contains or overlaps) this range
-
isMergedCell
public boolean isMergedCell()
- Specified by:
isMergedCell
in interfaceRange
- Returns:
- true if entire range is a merged cell.
-
getMergedRegion
public CellRegion getMergedRegion()
Description copied from interface:Range
Returns the merged region of the left top cell of this Range if any; otherwise, returns null if not a merged region.- Specified by:
getMergedRegion
in interfaceRange
- Returns:
- the merged region of the left top cell of this Range if any
-
getDataRegion
public CellRegion getDataRegion()
Description copied from interface:Range
Returns the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.- Specified by:
getDataRegion
in interfaceRange
- Returns:
- the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.
-
merge
public void merge(boolean across)
Description copied from interface:Range
Merges the range
-
unmerge
public void unmerge()
Description copied from interface:Range
Unmerge the range
-
toShiftedRange
public RangeImpl toShiftedRange(int rowOffset, int colOffset)
Description copied from interface:Range
Return a new range by shifting the current Range according to the offsets but still keep the original height and width e.g.// range is A1:B2 range.toShiftedRange(1, 0); //returns A2:B3
- Specified by:
toShiftedRange
in interfaceRange
- Parameters:
rowOffset
- row offset of the new range. Positive number shifts it down, negative number shifts it up.colOffset
- column offset of the new range. Positive number shifts it right, negative number shifts it left.- Returns:
- the new shifted range
-
toCellRange
public RangeImpl toCellRange(int rowOffset, int colOffset)
Description copied from interface:Range
Returns a new range having one cell according to the offset based on the left-top corner. For example://range is A1:B2 range.toCellRange(0, 0); // returns A1
- Specified by:
toCellRange
in interfaceRange
- Parameters:
rowOffset
- row offset of the cell.colOffset
- column offset of the cell.- Returns:
- the new range of the cell
-
getLeftTop
public RangeImpl getLeftTop()
get the top-left cell range of this range
-
toRowRange
public RangeImpl toRowRange()
Return a range that represents all columns and between the first-row and last-row of this range- Specified by:
toRowRange
in interfaceRange
-
toColumnRange
public RangeImpl toColumnRange()
Return a range that represents all rows and between the first-column and last-column of this range- Specified by:
toColumnRange
in interfaceRange
-
isWholeColumn
public boolean isWholeColumn()
Check if this range represents a whole column, which mean all rows are included,- Specified by:
isWholeColumn
in interfaceRange
-
isWholeRow
public boolean isWholeRow()
Check if this range represents a whole row, which mean all column are included,- Specified by:
isWholeRow
in interfaceRange
-
isWholeSheet
public boolean isWholeSheet()
Check if this range represents a whole sheet, which mean all column and row are included,- Specified by:
isWholeSheet
in interfaceRange
-
insert
public void insert(Range.InsertShift shift, Range.InsertCopyOrigin copyOrigin)
Description copied from interface:Range
Insert new cells to the area of this range.
To insert a row, you have to callRange.toRowRange()
first, to insert a column, you have to callRange.toColumnRange()
first.
-
delete
public void delete(Range.DeleteShift shift)
Description copied from interface:Range
Delete cells of the range.
To delete a row, you have to callRange.toRowRange()
first, to delete a column, you have to callRange.toColumnRange()
first.
-
sort
public void sort(boolean desc)
Description copied from interface:Range
Sort range
-
sort
public void sort(boolean desc, boolean hasHeader, boolean matchCase, boolean sortByRows, Range.SortDataOption dataOption)
Description copied from interface:Range
Sort range
-
sort
public void sort(Range key1, boolean desc1, Range.SortDataOption dataOption1, Range key2, boolean desc2, Range.SortDataOption dataOption2, Range key3, boolean desc3, Range.SortDataOption dataOption3, boolean header, boolean matchCase, boolean sortByRows)
Description copied from interface:Range
Sort range- Specified by:
sort
in interfaceRange
- Parameters:
key1
- the sort index 1desc1
- true for descent, false for ascent of index 1dataOption1
- data option 1 for sortkey2
- the sort index 2desc2
- true for descent, false for ascent of index 2dataOption2
- data option 2 for sortkey3
- the sort index 3desc3
- true for descent, false for ascent of index 3dataOption3
- data option31 for sortheader
- includes header or notmatchCase
- matches character chase of notsortByRows
- sorts by row or not
-
isAutoFilterEnabled
public boolean isAutoFilterEnabled()
check if auto filter is enable or not.- Specified by:
isAutoFilterEnabled
in interfaceRange
- Returns:
- true if auto filter is enabled.
-
findAutoFilterRange
public Range findAutoFilterRange()
Description copied from interface:Range
To find a range of cells for applying auto filter according to this range. Usually, these two ranges are different. This method searches the filtering range through a specific rules.- Specified by:
findAutoFilterRange
in interfaceRange
- Returns:
- a range of cells for applying auto filter or null if can't find one from this Range.
-
enableAutoFilter
public void enableAutoFilter(boolean enable)
enable/disable autofilter of the sheet- Specified by:
enableAutoFilter
in interfaceRange
- Parameters:
enable
- true to enable
-
enableAutoFilter
public void enableAutoFilter(int field, Range.AutoFilterOperation filterOp, Object criteria1, Object criteria2, Boolean showButton)
enable filter with condition- Specified by:
enableAutoFilter
in interfaceRange
- Parameters:
field
- the filed index (according to current range, 1 base)filterOp
- auto filter operationcriteria1
- criteria for autofiltercriteria2
- criteria for autofiltershowButton
- true/false for show/hide dropdown button, null will keep the original setting.
-
resetAutoFilter
public void resetAutoFilter()
clear criteria of all filters, show all the data- Specified by:
resetAutoFilter
in interfaceRange
-
applyAutoFilter
public void applyAutoFilter()
re-apply existing criteria of filters- Specified by:
applyAutoFilter
in interfaceRange
-
autoFill
public void autoFill(Range dest, Range.AutoFillType fillType)
Description copied from interface:Range
According to current range, fills data to destination range automatically
-
fillDown
public void fillDown()
Description copied from interface:Range
Fills cells by copying from first/top row data
-
fillLeft
public void fillLeft()
Description copied from interface:Range
Fills cells by copying from last/right column data
-
fillUp
public void fillUp()
Description copied from interface:Range
Fills cells by copying from bottom row data
-
fillRight
public void fillRight()
Description copied from interface:Range
Fills cells by copying from first/left column data
-
shift
public void shift(int rowOffset, int colOffset)
shift this range with a offset row and column
-
getCellEditText
public String getCellEditText()
Description copied from interface:Range
Gets the first cell(top-left) edit text of this range- Specified by:
getCellEditText
in interfaceRange
- Returns:
- edit text
- See Also:
CellData.getEditText()
-
setCellEditText
public void setCellEditText(String editText)
Description copied from interface:Range
Works like a user entering a text in a cell via a browser. So, this method supports "Smart Input", and it will parse the text and turn the text into a String, Number, Date, or Boolean according to the supported input format pattern. To enter a formula, the text should stat with=
.
This method applies all cells of this range.- Specified by:
setCellEditText
in interfaceRange
- Parameters:
editText
- the text to enter, it can be a string, integer string, date string or a formula (start with '=')
-
setArrayFormula
public void setArrayFormula(String editText)
Description copied from interface:Range
Works like a user entering an array formula in a cell or a range via a browser. So, this method supports "Smart Input", and it will parse the text and turn the text into a String, Number, Date, or Boolean according to the supported input format pattern. To enter a formula, the text should stat with=
.
This method applies all cells of this range.- Specified by:
setArrayFormula
in interfaceRange
- Parameters:
editText
- the text to enter, it can be a string, integer string, date string or a formula (start with '=')
-
getCellFormatText
public String getCellFormatText()
Description copied from interface:Range
Gets the first cell(top-left) formatted text of this range- Specified by:
getCellFormatText
in interfaceRange
- Returns:
- format text
- See Also:
CellData.getFormatText()
-
getCellDataFormat
public String getCellDataFormat()
Description copied from interface:Range
Gets the first cell(top-left) format of this range- Specified by:
getCellDataFormat
in interfaceRange
- Returns:
-
getCellValue
public Object getCellValue()
Description copied from interface:Range
Gets the first cell(top-left) value of this range- Specified by:
getCellValue
in interfaceRange
- Returns:
- value object or null for a blank cell
- See Also:
CellData.getValue()
-
getCellValues
public List<Object> getCellValues()
Description copied from interface:Range
Gets all cell values from left to right and top to bottom of this range in one dimensional list. Blank cell will be null value instead.
If the range is A1:C3, the method will return you a list of cell values like:
A1, B1, C1, A2, B2, C2, A3, B3, C3
- Specified by:
getCellValues
in interfaceRange
- Returns:
- values a object list
-
setDisplaySheetGridlines
public void setDisplaySheetGridlines(boolean enable)
Description copied from interface:Range
Displays sheet grid-lines or not- Specified by:
setDisplaySheetGridlines
in interfaceRange
- Parameters:
enable
- true to display
-
isDisplaySheetGridlines
public boolean isDisplaySheetGridlines()
- Specified by:
isDisplaySheetGridlines
in interfaceRange
- Returns:
- true if display sheet grid-lines is enabled
-
setHidden
public void setHidden(boolean hidden)
Description copied from interface:Range
Hide or unhide rows or columns.
To hide/unhide a row, you have to callRange.toRowRange()
first, to hide/un-hide a column, you have to callRange.toColumnRange()
or a whole column range.
-
setCellHyperlink
public void setCellHyperlink(Hyperlink.HyperlinkType type, String address, String display)
Description copied from interface:Range
Sets cell hyperlink, applies it too all cells- Specified by:
setCellHyperlink
in interfaceRange
- Parameters:
type
- the hyperlink typeaddress
- the address, e.x http://www.zkoss.orgdisplay
- the label to display
-
getCellHyperlink
public Hyperlink getCellHyperlink()
Description copied from interface:Range
Gets the first cell(top-left)Hyperlink
object of this range.- Specified by:
getCellHyperlink
in interfaceRange
- Returns:
-
setSheetName
public void setSheetName(String name)
Description copied from interface:Range
Sets the sheet name- Specified by:
setSheetName
in interfaceRange
- Parameters:
name
- new sheet name, it must be not same as another sheet name in it's owner book.
-
getSheetName
public String getSheetName()
Description copied from interface:Range
Gets the sheet name- Specified by:
getSheetName
in interfaceRange
- Returns:
- sheet name
-
setSheetOrder
public void setSheetOrder(int pos)
Description copied from interface:Range
Sets the sheet order- Specified by:
setSheetOrder
in interfaceRange
- Parameters:
pos
- the position
-
getSheetOrder
public int getSheetOrder()
Description copied from interface:Range
Gets the sheet order- Specified by:
getSheetOrder
in interfaceRange
- Returns:
-
setCellValue
public void setCellValue(Object value)
Description copied from interface:Range
Sets cell data value and type. Notice that it doesn't parse the specified String object. If you call:setCellValue("100")
, it will produce a text cell instead of an integer, one hundred. If you need a number cell, you need to callsetCellValue(100)
. The same rule applies to Date and Boolean.
This method applies all cells of this range.- Specified by:
setCellValue
in interfaceRange
- Parameters:
value
- the cell value, could be null, String, Number, Date or Boolean- See Also:
Range.setCellEditText(String)
-
setCellValues
public void setCellValues(Object... values)
Description copied from interface:Range
Sets cell data values, applies them to all cells from left to right and top to bottom consistently. For example:Set values in a row
The result is [3,2,1] from A1 to C1Range rA1C1 = Ranges.range("A1:C1"); rA1C1.setCellValues(3,2,1);
Set values in a column
The result is [1,2,3] from A1 to A3Range rA1A3 = Ranges.range("A1:A3"); rA1A3.setCellValues(1,2,3);
Set values in an area
The result is [9, 8, 7, 6, 5, 4, 3, 2, 1] from A1, B1, C1, A2, ... to C3Range rA1C3 = Ranges.range("A1:C3"); rA1C3.setCellValues(9, 8, 7, 6, 5, 4, 3,2,1);
Cell and values count mismatch
If you pass more values than cell number, then it just sets cells in this range, not over-fill.
The result is [1,2,3] from A1 to C1.rA1C1.setCellValues(1, 2, 3, 4, 5);
If you pass fewer values than cell number, then it just set cells according the number of values.
The result is [1,2] from A1 to B1.rA1C1.setCellValues(1, 2);
Transpose 2D Array when necessary
Since this method sets cells row by row, if you have a 2D array that contains column by column data. Then you can transpose the array first and pass to the method.- Specified by:
setCellValues
in interfaceRange
- Parameters:
values
- all cell values, could be null, String, Number, Date or Boolean
-
getCellStyle
public CellStyle getCellStyle()
get the first cell style of this range- Specified by:
getCellStyle
in interfaceRange
- Returns:
- cell style if cell is exist, the check row style and column cell style if cell not found, if row and column style is not exist, then return default style of sheet
-
addPicture
public Picture addPicture(SheetAnchor anchor, byte[] image, Picture.Format format)
Description copied from interface:Range
Adds picture to sheet- Specified by:
addPicture
in interfaceRange
- Parameters:
anchor
- the anchor for pictureimage
- the image binary arrayformat
- the image format- Returns:
- the new added picture
-
deletePicture
public void deletePicture(Picture picture)
Description copied from interface:Range
Deletes picture that in sheet- Specified by:
deletePicture
in interfaceRange
-
movePicture
public void movePicture(SheetAnchor anchor, Picture picture)
Description copied from interface:Range
Moves picture- Specified by:
movePicture
in interfaceRange
- Parameters:
anchor
- the anchor to re-allocatepicture
- the picture to re-allocate
-
updatePicture
public void updatePicture(Picture picture, SheetAnchor.AnchorType anchorType)
Description copied from interface:Range
Updates picture with anchor type- Specified by:
updatePicture
in interfaceRange
-
addChart
public Chart addChart(SheetAnchor anchor, Chart.Type type, Chart.Grouping grouping, Chart.LegendPosition pos)
Description copied from interface:Range
Adds chart to sheet
-
deleteChart
public void deleteChart(Chart chart)
Description copied from interface:Range
Deletes chart- Specified by:
deleteChart
in interfaceRange
- Parameters:
chart
- the chart to delete
-
moveChart
public void moveChart(SheetAnchor anchor, Chart chart)
Description copied from interface:Range
Moves chart to new location
-
updateChart
public void updateChart(Chart chart)
Description copied from interface:Range
Notify the component that a chart has change, e.g. call it after chart data changes.- Specified by:
updateChart
in interfaceRange
- Parameters:
chart
- the chart that contains change
-
updateChart
public void updateChart(Chart chart, SheetAnchor.AnchorType anchorType)
Description copied from interface:Range
Notify the component that a chart has change, e.g. call it after chart data changes.- Specified by:
updateChart
in interfaceRange
- Parameters:
chart
- the chart that contains change
-
createSheet
public Sheet createSheet(String name)
Description copied from interface:Range
Creates a new sheet and appends it as the last sheet. To move the new sheet to the specific position, seeRange.setSheetOrder(int)
.- Specified by:
createSheet
in interfaceRange
- Parameters:
name
- the sheet name, it must not be same as another sheet name in book of this range. Otherwise, it takes no effect.- Returns:
- the new created sheet
-
cloneSheet
public Sheet cloneSheet(String name)
Description copied from interface:Range
Clone this sheet; create a sheet and copy the contents of this sheet; then add it as the last sheet.- Specified by:
cloneSheet
in interfaceRange
- Parameters:
name
- the sheet name, it must not be the same as another sheet name in book of this range- Returns:
- the new created sheet
-
deleteSheet
public void deleteSheet()
Description copied from interface:Range
Deletes sheet. Note: You couldn't delete last sheet of a book.- Specified by:
deleteSheet
in interfaceRange
-
setColumnWidth
public void setColumnWidth(int widthPx)
Description copied from interface:Range
Sets the width(in pixel) of column in this range, it effect to whole column.- Specified by:
setColumnWidth
in interfaceRange
- Parameters:
widthPx
- width in pixel- See Also:
Range.toColumnRange()
-
setRowHeight
public void setRowHeight(int heightPx)
Description copied from interface:Range
Sets the height(in pixel) of row in this range, it effect to whole row.- Specified by:
setRowHeight
in interfaceRange
- Parameters:
heightPx
- height in pixel- See Also:
Range.toRowRange()
-
setRowHeight
public void setRowHeight(int heightPx, boolean isCustom)
Description copied from interface:Range
Sets the height(in pixel) of row in this range and specify it's custom size or not.- Specified by:
setRowHeight
in interfaceRange
- Parameters:
heightPx
- height in pixelisCustom
- true if it's set by users manually, false if it's determined by the system automatically
-
group
public void group()
Description copied from interface:Range
Groups the rows or columns by matching the range, which increases their outline level.Note: The maximum level is up to 7.
-
ungroup
public void ungroup()
Description copied from interface:Range
Ungroups the rows or columns by matching the range, which decreases their outline level.Note: The minimum level is down to 0.
-
notifyChange
public void notifyChange()
Description copied from interface:Range
Notify this range has been changed, then spreadsheet will render the changed cells to a browser. It's usually used withRange.setAutoRefresh(boolean)
.- Specified by:
notifyChange
in interfaceRange
-
notifyChange
public void notifyChange(String[] variables)
Description copied from interface:Range
Notify the whole book of specified variables change. Then spreadsheet will re-evaluate those cells that reference to these variables.- Specified by:
notifyChange
in interfaceRange
- Parameters:
variables
- changed variables
-
setFreezePanel
public void setFreezePanel(int rowfreeze, int columnfreeze)
Description copied from interface:Range
Set the freeze panel- Specified by:
setFreezePanel
in interfaceRange
- Parameters:
rowfreeze
- the number of row to freeze, 0 means no freezecolumnfreeze
- the number of column to freeze, 0 means no freeze
-
getRowCount
public int getRowCount()
Description copied from interface:Range
Gets the row count of this range- Specified by:
getRowCount
in interfaceRange
- Returns:
- count of row of this range
-
getColumnCount
public int getColumnCount()
Description copied from interface:Range
Gets the column count of this range- Specified by:
getColumnCount
in interfaceRange
- Returns:
- count of column of this range
-
asString
public String asString()
Description copied from interface:Range
get formatted string of this range
-
getInternalRange
public SRange getInternalRange()
Description copied from interface:Range
Get internal range implementation- Specified by:
getInternalRange
in interfaceRange
-
createName
public void createName(String nameName)
Description copied from interface:Range
Create a name that refers to this range. You can get this named ranage byRanges.rangeByName(Sheet, String)
.- Specified by:
createName
in interfaceRange
- Parameters:
nameName
- name of the range that you can refer in formulas.
-
protectSheet
public void protectSheet(String password, boolean allowSelectingLockedCells, boolean allowSelectingUnlockedCells, boolean allowFormattingCells, boolean allowFormattingColumns, boolean allowFormattingRows, boolean allowInsertColumns, boolean allowInsertRows, boolean allowInsertingHyperlinks, boolean allowDeletingColumns, boolean allowDeletingRows, boolean allowSorting, boolean allowFiltering, boolean allowUsingPivotTables, boolean drawingObjects, boolean scenarios)
Description copied from interface:Range
Protect aSheet
so that it cannot be modified. You can call this method on a protected sheet to change its allowed options if the same password is supplied; otherwise, it is ignored. A protected sheet can be unprotected by callingRange.unprotectSheet(String password)
. change the protection options; make sure provide- Specified by:
protectSheet
in interfaceRange
- Parameters:
password
- a case-sensitive password for the sheet; null or empty string means protect the sheet without password.allowSelectingLockedCells
- true to allow select locked cells; default to true.allowSelectingUnlockedCells
- true to allow select unlocked cells; default to true.allowFormattingCells
- true to allow user to format any cell on the protected sheet; default false.allowFormattingColumns
- true to allow user to format any columns on the protected sheet; default false.allowFormattingRows
- true to allow user to format any rows on the protected sheet; default false.allowInsertColumns
- true to allow user to insert columns on the protected sheet; default false.allowInsertRows
- true to allow user to insert rows on the protected sheet; default false.allowInsertingHyperlinks
- true to allow user to insert hyperlinks on the protected sheet; default false.allowDeletingColumns
- true to allow user to delete columns on the protected sheet; default false.allowDeletingRows
- true to allow user to delete rows on the protected sheet; default false.allowSorting
- true to allow user to sort on the protected sheet; default false.allowFiltering
- true to allow user to set filters on the protected sheet; default false.allowUsingPivotTables
- true to allow user to use pivot table reports on the protected sheet; default false.drawingObjects
- true to protect objects; default to false.scenarios
- true to protect scenarios; default to true.- See Also:
Range.protectSheet(io.keikai.api.SheetProtection)
,Range.unprotectSheet(String password)
,Range.isProtected()
-
protectSheet
public void protectSheet(SheetProtection protection)
Description copied from interface:Range
Protect aSheet
so that it cannot be modified.- Specified by:
protectSheet
in interfaceRange
- See Also:
SheetProtection
-
unprotectSheet
public boolean unprotectSheet(String password)
Description copied from interface:Range
Removes protection from a sheet. This method has no effect if the sheet isn't protected.- Specified by:
unprotectSheet
in interfaceRange
- Parameters:
password
- a case-sensitive password used to unprotect the sheet. If the sheet isn't protected with a password, this argument is ignored. If you omit this argument for a sheet that is protected with a password, you'll be prompted for the password.
-
getSheetProtection
public SheetProtection getSheetProtection()
Description copied from interface:Range
GetsSheetProtection
which tells what are allowed operations for a protected sheet of this range.- Specified by:
getSheetProtection
in interfaceRange
- Returns:
-
validate
public Validation validate(String editText)
Description copied from interface:Range
validate the user's input.
-
setValidation
public void setValidation(Validation.ValidationType validationType, boolean ignoreBlank, Validation.OperatorType operatorType, boolean inCellDropDown, String formula1, String formula2, boolean showInput, String inputTitle, String inputMessage, boolean showError, Validation.AlertStyle alertStyle, String errorTitle, String errorMessage)
Description copied from interface:Range
Add if not exist or modify an existingValidation
to this range. There are two ways to input list items for data validation in argument "formula1" and "formula2". One is to specify a range via a formula such as "=A1:A4" where the values in the cells of the range is the constrained value list; another is to input literally the constrained value list delimited by comma such as "1, 2, 3, 4". Note that when you input a formula, must lead the formula with an equal sign('=').- Specified by:
setValidation
in interfaceRange
- Parameters:
validationType
- the type of this validationignoreBlank
- true if blank values are permitted.operatorType
- the operator for this validationinCellDropDown
- true if want to display dropdown list for acceptable values.formula1
- the value or expression associated with conditional format or data validation.formula2
- the 2nd part of a conditional format or data validation. Useful only when operatorType is BETWEEN or NOT_BETWEEN.showInput
- true to show the input message.inputTitle
- title for the data-validation input dialog box.inputMessage
- message for the data-validation input dialog box.showError
- true to show the error message.alertStyle
- validation alert style.errorTitle
- title of the data validation error dialog.errorMessage
- data validation error message.
-
getValidations
public List<Validation> getValidations()
Description copied from interface:Range
Gets read-onlyValidation
associated with the left-top cell of this range; return null if no associated validation.
-
deleteValidation
public void deleteValidation()
Description copied from interface:Range
Delete theValidation
associated in the specified range.- Specified by:
deleteValidation
in interfaceRange
-
setCellRichText
public void setCellRichText(String html)
Description copied from interface:Range
Set into the left top cell of this Range the specified text in html format.- Specified by:
setCellRichText
in interfaceRange
-
getCellRichText
public String getCellRichText()
Description copied from interface:Range
Returns text in html format; null if not a rich text.- Specified by:
getCellRichText
in interfaceRange
-
getOrCreateFont
public Font getOrCreateFont(Font.Boldweight boldweight, Color color, int fontHeight, String fontName, boolean italic, boolean strikeout, Font.TypeOffset typeOffset, Font.Underline underline)
Description copied from interface:Range
Get font if exists or create font if not exists from the book of this range and return it.- Specified by:
getOrCreateFont
in interfaceRange
- Returns:
- font of the specified font metrics
-
refresh
public void refresh(boolean includeDependants)
Description copied from interface:Range
Enforce evaluation(if not cached) and refresh UI of this range and its dependent cells if the includeDependents is true. This method is equal to {@link Range#refresh(boolean includeDependents, boolean false, boolean true)}.
-
setAutoRefresh
public boolean setAutoRefresh(boolean auto)
Description copied from interface:Range
Turn on(true)/off(false) of auto refresh of this range and return previous on/off status; default is true. If you turn off auto refresh, you need to callRange.notifyChange()
manually at the proper moment.- Specified by:
setAutoRefresh
in interfaceRange
- Parameters:
auto
- whether refresh automatically- Returns:
- previous status
-
refresh
public void refresh(boolean includeDependants, boolean clearCache, boolean enforceEval)
Description copied from interface:Range
Update data model and refresh UI of this range and its dependent cells if the argument includeDependents is true. Note that when you set parameter clearCache to true, the cached formula result in data model will be cleared first. If you set parameter enforceEval to true, data model associated with this range will be evaluated immediately; otherwise will be evaluated on demand.
-
setSheetVisible
public void setSheetVisible(Range.SheetVisible visible)
Description copied from interface:Range
Setup sheet's visibility; can be VISIBLE, HIDDEN, or VERY_HIDDEN.- VISIBLE: the sheet is visible
- HIDDEN: the sheet is hidden but can be unhidden using UI
- VERY_HIDDEN: the sheet is hidden but can be unhidden only via this API.
- Specified by:
setSheetVisible
in interfaceRange
- See Also:
Range.SheetVisible
-
getCommentRichText
public String getCommentRichText()
Description copied from interface:Range
Return the comment rich edit text of the left top cell of this Range.- Specified by:
getCommentRichText
in interfaceRange
- Returns:
- the rich edit text of this Range.
-
setCommentRichText
public void setCommentRichText(String html)
Description copied from interface:Range
Set comment rich text into the left top cell of this range; null to delete it.- Specified by:
setCommentRichText
in interfaceRange
-
setCommentVisible
public void setCommentVisible(boolean visible)
Description copied from interface:Range
Set comment visibility into the left top cell of this range; if no comment at the cell, it simply ignored.- Specified by:
setCommentVisible
in interfaceRange
-
isCommentVisible
public boolean isCommentVisible()
Description copied from interface:Range
Returns whether the comment is always visible at the left top cell of this range; if no comment at the cell, it returns false.- Specified by:
isCommentVisible
in interfaceRange
- Returns:
-
notifyChange
public void notifyChange(Range.CellAttribute cellAttr)
Description copied from interface:Range
Notify this range has been changed on the specifield attribute.- Specified by:
notifyChange
in interfaceRange
-
setNameName
public void setNameName(String namename, String newname)
Description copied from interface:Range
Set(Rename) the name of the Name(or Table) as specified in this Range(a Book or a Sheet).- Specified by:
setNameName
in interfaceRange
- Parameters:
namename
- name of the Name(or Table)newname
- new name for the Name(or Table)
-
setStringValue
public void setStringValue(String text)
Description copied from interface:Range
Save the specified value into this range as a String no matter the value is prefixed with '=' or not.- Specified by:
setStringValue
in interfaceRange
-
cloneSheetFrom
public Sheet cloneSheetFrom(String name, Sheet sheet)
Description copied from interface:Range
Clone from the specified source sheet to the owner book of this range. The book can be different between the owner book of this range and of the specified source sheet.- Specified by:
cloneSheetFrom
in interfaceRange
- Parameters:
name
- the name of the new created sheet; null would try to use the sheet name of the specified source sheet; if the same sheet name already used in the owner book of this range then use default "SheetX" name where X is the next sheet number of the owner book of this range.sheet
- the source sheet to clone from to the owner book of this range.- Returns:
- the new created sheet
- See Also:
Range.cloneSheetFrom(String, Sheet, boolean)
-
cloneSheetFrom
public Sheet cloneSheetFrom(String name, Sheet sheet, boolean valueOnly)
Description copied from interface:Range
Clone from the specified source sheet to the owner book of this range. The book can be different between the owner book of this range and of the specified source sheet.- Specified by:
cloneSheetFrom
in interfaceRange
- Parameters:
name
- the name of the new created sheet; null would try to use the sheet name of the specified source sheet; if the same sheet name already used in the owner book of this range then use default "SheetX" name where X is the next sheet number of the owner book of this range.sheet
- the source sheet to clone from to the owner book of this range.valueOnly
- true to copy the cell value only- Returns:
- the new created sheet
-
zOrderStream
public Stream<Range> zOrderStream()
Description copied from interface:Range
Returns a z-order cell range stream which treats a merged cell as one range. For example,// Data: // | A | B | C | D | E | // ---+---+---+---+---+---+ // 1 | 1 | | 3 | | // ---+---+ +---+---+ // 2 | | | | | // ---+ + + 5 +---+ // 3 | 4 | 2 | | | // ---+ + +---+---+ // 4 | | | 6 | | // ---+---+ +---+---+ // 5 | 7 | | 8 | | // ---+---+-------+---+---+ Stream
zOrder = Ranges.range("A1:D5").zOrderStream(); zOrder.map(Range::getCellValue) .map(Object::toString) .collect(Collectors.joining(", ")); // Result: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0- Specified by:
zOrderStream
in interfaceRange
-
nOrderStream
public Stream<Range> nOrderStream()
Description copied from interface:Range
Returns a n-order cell range stream which treats a merged cell as one range. For example,// Data: // | A | B | C | D | E | // ---+---+---+---+---+---+ // 1 | 1 | | 3 | | // ---+---+ +---+---+ // 2 | | | | | // ---+ + + 5 +---+ // 3 | 4 | 2 | | | // ---+ + +---+---+ // 4 | | | 6 | | // ---+---+ +---+---+ // 5 | 7 | | 8 | | // ---+---+-------+---+---+ Stream
nOrder = Ranges.range("A1:D5").nOrderStream(); nOrder.map(Range::getCellValue) .map(Object::toString) .collect(Collectors.joining(", ")); // Result: 1.0, 4.0, 7.0, 2.0, 3.0, 5.0, 6.0, 8.0- Specified by:
nOrderStream
in interfaceRange
-
getDirectPrecedents
public Set<Range> getDirectPrecedents()
Description copied from interface:Range
Returns Range(s) that are the direct precedents of this cell Range. If this Range covers more than one cell, the left-top one is used.- Specified by:
getDirectPrecedents
in interfaceRange
-
getPrecedents
public Set<Range> getPrecedents()
Description copied from interface:Range
Returns all Range(s) that are the direct or indirect precedents of this cell Range. If this Range covers more than one cell, the left-top one is used.- Specified by:
getPrecedents
in interfaceRange
-
getDirectDependents
public Set<Range> getDirectDependents()
Description copied from interface:Range
Returns Range(s) that are the direct dependents of this cell Range. If this Range covers more than one cell, the left-top one is used.- Specified by:
getDirectDependents
in interfaceRange
-
getDependents
public Set<Range> getDependents()
Description copied from interface:Range
Returns all Range(s) that are the direct or indirect dependents of this cell Range. If this Range covers more than one cell, the left-top one is used.- Specified by:
getDependents
in interfaceRange
-
tracePrecedents
public void tracePrecedents()
Description copied from interface:Range
Trace the precedents of this range.- Specified by:
tracePrecedents
in interfaceRange
-
traceDependents
public void traceDependents()
Description copied from interface:Range
Trace the dependents of this range.- Specified by:
traceDependents
in interfaceRange
-
clearTrace
public void clearTrace()
Description copied from interface:Range
Clears the current tracing.- Specified by:
clearTrace
in interfaceRange
-
getRowGroups
public List<Range> getRowGroups()
Description copied from interface:Range
Returns all group ranges for rows, which intersect with this range.- Specified by:
getRowGroups
in interfaceRange
- Returns:
- an empty list if not matched.
-
getRowGroups
public List<Range> getRowGroups(int outlineLevel)
Description copied from interface:Range
Returns all group ranges matched the given outline level for rows, which intersect with this range.- Specified by:
getRowGroups
in interfaceRange
- Parameters:
outlineLevel
- a valid value in a range is from 1 to 7 (inclusive).- Returns:
- an empty list if not matched.
-
getRowGroups
public List<Range> getRowGroups(int fromOutlineLevel, int toOutlineLevel)
Description copied from interface:Range
Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for rows, which intersect with this range.- Specified by:
getRowGroups
in interfaceRange
- Parameters:
fromOutlineLevel
- 1~7 (inclusive)toOutlineLevel
- 2~8 (exclusive)- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<Range> getColumnGroups()
Description copied from interface:Range
Returns all group ranges for columns, which intersect with this range.- Specified by:
getColumnGroups
in interfaceRange
- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<Range> getColumnGroups(int outlineLevel)
Description copied from interface:Range
Returns all group ranges matched the given outline level for columns, which intersect with this range.- Specified by:
getColumnGroups
in interfaceRange
- Parameters:
outlineLevel
- a valid value in a range is from 1 to 7 (inclusive).- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<Range> getColumnGroups(int fromOutlineLevel, int toOutlineLevel)
Description copied from interface:Range
Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for columns, which intersect with this range.- Specified by:
getColumnGroups
in interfaceRange
- Parameters:
fromOutlineLevel
- 1~7 (inclusive)toOutlineLevel
- 2~8 (exclusive)- Returns:
- an empty list if not matched.
-
setSummaryBelow
public void setSummaryBelow(boolean summaryBelow)
Description copied from interface:Range
Sets to be true to display summary group as below or to be false to display summary group as above for rows.Note: One setting to affect whole sheet, if the value is up-side-down against the previous value, it will clear all outline level for rows and columns.
Default:
true
- Specified by:
setSummaryBelow
in interfaceRange
- Parameters:
summaryBelow
- true to display as below for rows.
-
isSummaryBelow
public boolean isSummaryBelow()
Description copied from interface:Range
Returns whether to display group summary as below for rows.Default:
true
- Specified by:
isSummaryBelow
in interfaceRange
-
setSummaryRight
public void setSummaryRight(boolean summaryRight)
Description copied from interface:Range
Sets to be true to display summary group as right or to be false to display summary group as left for columns.Note: One setting to affect whole sheet, if the value is up-side-down against the previous value, it will clear all outline level for rows and columns.
Default:
true
- Specified by:
setSummaryRight
in interfaceRange
- Parameters:
summaryRight
- true to display as right for columns.
-
isSummaryRight
public boolean isSummaryRight()
Description copied from interface:Range
Returns whether to display group summary as right for columns.Default:
true
- Specified by:
isSummaryRight
in interfaceRange
-
collapse
public void collapse()
Description copied from interface:Range
Collapses one group by matching with the range at a time (not affected its descendant).
-
expand
public void expand()
Description copied from interface:Range
Expands one group by matching with the range at a time (not affected its descendant).
-
clearOutlineLevel
public void clearOutlineLevel()
Description copied from interface:Range
Clears all outline level for all groups that intersect with the range.2:4
for rows andC:E
for columns- Specified by:
clearOutlineLevel
in interfaceRange
-
isCollapsed
public boolean isCollapsed()
Description copied from interface:Range
Returns whether the group by matching with the range has collapsed or not. Otherwise, returns false instead.- Specified by:
isCollapsed
in interfaceRange
-
getOutlineLevel
public int getOutlineLevel()
Description copied from interface:Range
Returns the outline of the group by matching with the range. Otherwise, returns 0 instead.- Specified by:
getOutlineLevel
in interfaceRange
-
-