Package io.keikai.range.impl
Class RangeImpl
- java.lang.Object
-
- io.keikai.range.impl.RangeImpl
-
- All Implemented Interfaces:
SRange,Serializable
- Direct Known Subclasses:
PasteRangeImpl
public class RangeImpl extends Object implements SRange, Serializable
Only those methods that set cell data, cell style, row (column) style, width, height, and hidden consider 3-D references. Others don't, just perform on first cell.- Since:
- 3.5.0
- Author:
- dennis
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.keikai.range.SRange
SRange.ApplyBorderType, SRange.AutoFilterOperation, SRange.DeleteShift, SRange.FillType, SRange.InsertCopyOrigin, SRange.InsertShift, SRange.PasteOperation, SRange.PasteType, SRange.SheetVisible, SRange.SortDataOption
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SChartaddChart(ViewAnchor anchor, SChart.ChartType type, SChart.ChartGrouping grouping, SChart.ChartLegendPosition pos, boolean isThreeD)Add a chart into the sheet of this RangeSPictureaddPicture(ViewAnchor anchor, byte[] image, SPicture.Format format)Add a picture into the sheet of this RangevoidapplyAutoFilter()Apply the autofilter with the old condition and current cell valuesvoidclearAll()Clear data contains, style and unmerge this rangevoidclearCellStyles()Clear the cell styles of this RangevoidclearContents()Clears the data from this Range.voidclearOutlineLevel()Clears all outline level for all groups that intersect with the range.voidclearTrace()Clears the tracing of this range.SSheetcloneSheet(String name)Clone sheet as specified in this Range.SSheetcloneSheetFrom(String name, SSheet sheet)Clone from the specified source sheet to the owner book of this range.SSheetcloneSheetFrom(String name, SSheet sheet, boolean valueOnly)Clone from the specified source sheet to the owner book of this range.voidcollapse()Collapses one group by matching with the 1st selected area of this Range in rows or columns.SRangecopy(SRange dstRange)Copy data from this range to the specified destination range.SRangecopy(SRange dstRange, boolean cut)cut the selected range and paste to destination range.voidcreateName(String nameName)Create aSNamethat refer to this range.SSheetcreateSheet(String name)Create sheet of this book as specified in this Range.voiddelete(SRange.DeleteShift shift)Delete cells of this Range.voiddeleteChart(SChart chart)Delete an existing chart from the sheet of this Range.voiddeletePicture(SPicture picture)Delete an existing picture from the sheet of this Range.voiddeleteSheet()Delete sheet of this Range.voiddeleteValidation()Delete theSDataValidationassociated in the specified range.SAutoFilterenableAutoFilter(boolean enable)Enable the auto filter and return it, get null if you disable it.SAutoFilterenableAutoFilter(int field, SAutoFilter.FilterOp filterOp, Object criteria1, Object criteria2, Boolean visibleDropDown)Filters a list specified by this Range and returns an AutoFilter object.voidexpand()Expands one group by matching with the 1st selected area of this Range in rows or columns.voidfill(SRange dstRange, SRange.FillType fillType)Perform an auto fill on the specified destination Range.voidfillDown()Fills down from the top cells of this Range to the rest of this Range.voidfillLeft()Fills left from the rightmost cells of this Range to the rest of this Range.voidfillRight()Fills right from the leftmost cells of this Range to the rest of this Range.voidfillUp()Fills up from the bottom cells of this Range to the rest of this Range.SRangefindAutoFilterRange()To find a range of cells for applying auto filter according to this range.SBookgetBook()Returns the associatedSBookof this range.SBookSeriesgetBookSeries()Returns the associatedSBookSeriesof this range.StringgetCellDataFormat()Gets the first(top-left) cell's format, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it transfer the format by LOCALE(e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)StringgetCellFormatText()Gets the first(top-left) cell's formatted text, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it will formats the value by transferred format (e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)SCellStylegetCellStyle()Gets the first(top-left) cell's styleintgetColumn()Returns the number of the 1st column of the 1st area in this Range(0-based; i.e.List<SRange>getColumnGroups()Returns all group ranges for columns, which intersect with this range.List<SRange>getColumnGroups(int outlineLevel)Returns all group ranges matched the given outline level for columns, which intersect with this range.List<SRange>getColumnGroups(int fromOutlineLevel, int toOutlineLevel)Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for columns, which intersect with this range.SRangegetColumns()Returns aSRangethat represent columns of the 1st selected area of this Range.StringgetCommentRichText()Return the comment rich edit text of the left top cell of this Range.CellRegiongetDataRegion()Returns the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.Set<SRange>getDependents()Returns all Range(s) that are the direct or indirect dependents of this cell Range.Set<SRange>getDirectDependents()Returns Range(s) that are the direct dependents of this cell Range.Set<SRange>getDirectPrecedents()Returns Range(s) that are the direct precedents of this cell Range.StringgetEditText()Return the edit text of this Range.SHyperlinkgetHyperlink()Returns the hyperlink of this Range.intgetLastColumn()Returns the number of the last column of the 1st area in this Range(0-based; i.e.intgetLastRow()Returns the number of the last row of the 1st area in this Range(0-based; i.e.ReadWriteLockgetLock()CellRegiongetMergedRegion()Returns the merged region of the left top cell of this Range if any; otherwise, returns null if not a merged region.SRangegetOffset(int rowOffset, int colOffset)Returns aSRangethat represents a range that offset from this Range.SFontgetOrCreateFont(SFont.Boldweight boldweight, String htmlColor, int fontHeight, String fontName, boolean italic, boolean strikeout, SFont.TypeOffset typeOffset, SFont.Underline underline)Get font if exists or create font if not exists from the book of this range and return it.intgetOutlineLevel()Returns the outline level of the group by matching with the 1st selected area of this Range in rows or columns.Set<SRange>getPrecedents()Returns all Range(s) that are the direct or indirect precedents of this cell Range.StringgetRichText()Return the rich edit text of the left top cell of this Range.intgetRow()Returns the number of the 1st row of the 1st area in this Range(0-based; i.e.List<SRange>getRowGroups()Returns all group ranges for rows, which intersect with this range.List<SRange>getRowGroups(int outlineLevel)Returns all group ranges matched the given outline level for rows, which intersect with this range.List<SRange>getRowGroups(int fromOutlineLevel, int toOutlineLevel)Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for rows, which intersect with this range.SRangegetRows()Returns aSRangethat represent rows of the 1st selected area of this Range.SSheetgetSheet()Returns associateSSheetof this range.SSheetProtectiongetSheetProtection()GetsSSheetProtectionprotection options that tells what are allowed operations for the protected sheet of the first region of this range.List<SDataValidation>getValidations()GetsSDataValidations associated with this range; if more than one validation is present, will return at most two.ObjectgetValue()Returns left top cell value of this Range.List<Object>getValues()Returns all cell values from left to right and top to bottom of this Range in one dimension list.voidgroup()Groups the rows or columns by matching the range, which increases their outline level.voidinsert(SRange.InsertShift shift, SRange.InsertCopyOrigin copyOrigin)Insert cells of this Range.booleanisAnyCellProtected()Returns whether any cell is protected and locked in this Range.booleanisCollapsed()Returns whether the group by matching with the 1st selected area of this Range in rows or columns, which has collapsed or not.booleanisCommentVisible()Returns whether the comment is always visible at the left top cell of this range; if no comment at the cell, it returns false.booleanisProtected()Gets the first region's protection status; return true if the sheet of the first region is protected and some cells in the region is locked.booleanisSheetProtected()Gets whether the sheet of the first region of this Range is protected.booleanisSummaryBelow()Returns whether to display group summary as below for rows.booleanisSummaryRight()Returns whether to display group summary as right for columns.booleanisWholeColumn()Check if this range cover an entire columns (form 0, and last row to the max available column of a sheet)booleanisWholeRow()Check if this range cover an entire rows (form 0, and last row to the max available row of a sheet)booleanisWholeSheet()Check if this range cover an entire sheetvoidmerge(boolean across)Merge cells of this range into a merged cell.voidmove(int nRow, int nCol)Move this range to a new place as specified by row offset (negative value to move up; positive value to move down) and column offset(negative value to move left; positive value to move right)voidmoveChart(SChart chart, ViewAnchor anchor)Move the chart to the new anchor.voidmovePicture(SPicture picture, ViewAnchor anchor)Update picture anchor.voidnotifyChange()Notify this range has been changed.voidnotifyChange(CellAttribute cellAttr)Notify this range has been changed with the specified attribute.voidnotifyChange(String[] variables)Notify the variables in this range has been changed.voidnotifyCustomEvent(String customEventName, Object data, boolean writelock)Send a custom model event to all book's listener, the event name must not conflict with that inModelEventsSRangepasteSpecial(SRange dstRange, SRange.PasteType pasteType, SRange.PasteOperation pasteOp, boolean skipBlanks, boolean transpose)Pastes to a destination Range from this range.SRangepasteSpecial0(SRange dstRange, PasteOption option)voidprotectSheet(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 aSSheetso that it cannot be modified.voidrefresh(boolean includeDependants)Evaluate(if not cached), update data model, and refresh UI of this range and its dependent cells if the includeDependents is true.voidrefresh(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.voidresetAutoFilter()Reset the autofilter, clear the condition, shows all the hidden rowvoidsetArrayFormula(String editText)Set an array formula as input by the end user.booleansetAutoRefresh(boolean auto)Turn on(true)/off(false) of auto refresh of this range and return previous on/off status; default is true.voidsetBorders(SRange.ApplyBorderType borderType, SBorder.BorderType lineStyle, String color)Adds/Remove border of all cells within this range upon the specified border type.voidsetCellStyle(SCellStyle style)Sets a Style object to this Range.voidsetColumnWidth(int widthPx)Sets column width in unit of pixelvoidsetColumnWidth(int widthPx, boolean custom)Sets the width(in pixel) of column in this range, it effects to whole column.voidsetCommentRichText(String html)Set comment rich text into the left top cell of this range; null to delete it.voidsetCommentVisible(boolean visible)Set comment visibility into the left top cell of this range; if no comment at the cell, it simply ignored.voidsetDisplayGridlines(boolean show)Sets whether show the gridlines of the sheets in this Range.voidsetEditText(String editText)Set plain text as input by the end user.voidsetFreezePanel(int numOfRow, int numOfColumn)Set the freeze panelvoidsetHidden(boolean hidden)Sets whether this rows or columns are hidden(useful only if this Range cover entire column or entire row)protected voidsetHiddenInLock(boolean hidden)voidsetHyperlink(SHyperlink.HyperlinkType linkType, String address, String display)Sets the hyperlink of this RangevoidsetNameName(String namename, String newname)Set(Rename) the name of the Name(or Table) as specified in this Range(a Book or a Sheet).voidsetRichText(String html)Set rich text into the left top cell of this range.voidsetRowHeight(int heightPx)Sets row height in unit of pixelvoidsetRowHeight(int heightPx, boolean custom)Sets the height(in pixel) of row in this range, it effects to whole row.voidsetSheetName(String newname)Set(Rename) the name of the sheet as specified in this Range.voidsetSheetOrder(int pos)Sets the order of the sheet as specified in this Range.voidsetSheetVisible(SRange.SheetVisible visible)Set Sheet visibility; can be SheetVisible.VISIBLE, SheetVisible.HIDDEN, and SheetVisible.VERY_HIDDEN.voidsetStringValue(String value)Save the specified value into this range as a String no matter the value is prefixed with '=' or not.voidsetSummaryBelow(boolean summaryBelow)Sets to be true to display summary group as below or to be false to display summary group as above for rows.voidsetSummaryRight(boolean summaryRight)Sets to be true to display summary group as right or to be false to display summary group as left for columns.voidsetValidation(SDataValidation.ValidationType validationType, boolean ignoreBlank, SDataValidation.OperatorType operatorType, boolean inCellDropDown, String formula1, String formula2, boolean showInput, String inputTitle, String inputMessage, boolean showError, SDataValidation.AlertStyle alertStyle, String errorTitle, String errorMessage)Add if not exist or modify an existingSDataValidationto this range.voidsetValue(Object value)Set value into this Range.voidsetValues(Object... values)Set values into this Range from left to right and top to bottom consistently.voidsort(SRange key1, boolean descending1, SRange.SortDataOption dataOption1, SRange key2, boolean descending2, SRange.SortDataOption dataOption2, SRange key3, boolean descending3, SRange.SortDataOption dataOption3, int hasHeader, boolean matchCase, boolean sortByRows)Sort this Range according the specified parametersvoidtraceDependents()Trace the precedent of this range.voidtracePrecedents()Trace the dependents of this range.voidungroup()Ungroups the rows or columns by matching the range, which decreases their outline level.voidunmerge()Un-merge a merged cell in this range to separated cells.booleanunprotectSheet(String password)Removes protection from a sheet.voidupdateChart(SChart chart)Notify the model that a chart contains change, for example, chart data changes.SDataValidationvalidate(String editText)Returns whether the plain text input by the end user is valid or not; note the validation only applies to the left-top cell of this Range.
-
-
-
Constructor Detail
-
RangeImpl
public RangeImpl(SBook book)
-
RangeImpl
public RangeImpl(SSheet sheet)
-
RangeImpl
public RangeImpl(SSheet sheet, int row, int col)
-
RangeImpl
public RangeImpl(SSheet sheet, int tRow, int lCol, int bRow, int rCol)
-
RangeImpl
public RangeImpl(SSheet sheet, CellRegion region)
-
-
Method Detail
-
getLock
public ReadWriteLock getLock()
-
getBookSeries
public SBookSeries getBookSeries()
Description copied from interface:SRangeReturns the associatedSBookSeriesof this range.- Specified by:
getBookSeriesin interfaceSRange- Returns:
- the associated BookSeries
-
getBook
public SBook getBook()
Description copied from interface:SRangeReturns the associatedSBookof this range.
-
tracePrecedents
public void tracePrecedents()
Description copied from interface:SRangeTrace the dependents of this range.- Specified by:
tracePrecedentsin interfaceSRange
-
traceDependents
public void traceDependents()
Description copied from interface:SRangeTrace the precedent of this range.- Specified by:
traceDependentsin interfaceSRange
-
clearTrace
public void clearTrace()
Description copied from interface:SRangeClears the tracing of this range.- Specified by:
clearTracein interfaceSRange
-
getSheet
public SSheet getSheet()
Description copied from interface:SRangeReturns associateSSheetof this range.
-
getRow
public int getRow()
Description copied from interface:SRangeReturns the number of the 1st row of the 1st area in this Range(0-based; i.e. row1 return 0)
-
getColumn
public int getColumn()
Description copied from interface:SRangeReturns the number of the 1st column of the 1st area in this Range(0-based; i.e. Column A return 0)
-
getLastRow
public int getLastRow()
Description copied from interface:SRangeReturns the number of the last row of the 1st area in this Range(0-based; i.e. row1 return 0)- Specified by:
getLastRowin interfaceSRange- Returns:
- the number of the last row of the 1st area in this Range(0-based; i.e. row1 return 0)
-
getLastColumn
public int getLastColumn()
Description copied from interface:SRangeReturns the number of the last column of the 1st area in this Range(0-based; i.e. Column A return 0)- Specified by:
getLastColumnin interfaceSRange- Returns:
- the number of the last column of the 1st area in this Range(0-based; i.e. Column A return 0)
-
setRichText
public void setRichText(String html)
Description copied from interface:SRangeSet rich text into the left top cell of this range.- Specified by:
setRichTextin interfaceSRange
-
getRichText
public String getRichText()
Description copied from interface:SRangeReturn the rich edit text of the left top cell of this Range.- Specified by:
getRichTextin interfaceSRange- Returns:
- the rich edit text of this Range.
-
setValue
public void setValue(Object value)
Description copied from interface:SRangeSet value into this Range.
-
setValues
public void setValues(Object... values)
Description copied from interface:SRangeSet values into this Range from left to right and top to bottom consistently.
-
clearContents
public void clearContents()
Description copied from interface:SRangeClears the data from this Range.- Specified by:
clearContentsin interfaceSRange
-
clearCellStyles
public void clearCellStyles()
Description copied from interface:SRangeClear the cell styles of this Range- Specified by:
clearCellStylesin interfaceSRange
-
clearAll
public void clearAll()
Description copied from interface:SRangeClear data contains, style and unmerge this range
-
setEditText
public void setEditText(String editText)
Description copied from interface:SRangeSet plain text as input by the end user.- Specified by:
setEditTextin interfaceSRange- Parameters:
editText- the string input by the end user.
-
setArrayFormula
public void setArrayFormula(String editText)
Description copied from interface:SRangeSet an array formula as input by the end user.- Specified by:
setArrayFormulain interfaceSRange- Parameters:
editText- the string input by the end user.
-
getEditText
public String getEditText()
Description copied from interface:SRangeReturn the edit text of this Range.- Specified by:
getEditTextin interfaceSRange- Returns:
- the edit text of this Range.
-
notifyChange
public void notifyChange()
Description copied from interface:SRangeNotify this range has been changed.- Specified by:
notifyChangein interfaceSRange
-
notifyChange
public void notifyChange(CellAttribute cellAttr)
Description copied from interface:SRangeNotify this range has been changed with the specified attribute.- Specified by:
notifyChangein interfaceSRange
-
notifyChange
public void notifyChange(String[] variables)
Description copied from interface:SRangeNotify the variables in this range has been changed.- Specified by:
notifyChangein interfaceSRange
-
isWholeSheet
public boolean isWholeSheet()
Description copied from interface:SRangeCheck if this range cover an entire sheet- Specified by:
isWholeSheetin interfaceSRange
-
isWholeRow
public boolean isWholeRow()
Description copied from interface:SRangeCheck if this range cover an entire rows (form 0, and last row to the max available row of a sheet)- Specified by:
isWholeRowin interfaceSRange
-
getRows
public SRange getRows()
Description copied from interface:SRangeReturns aSRangethat represent rows of the 1st selected area of this Range. Note that only the 1st selected area is considered if this Range is a multiple-selected Range.
-
setRowHeight
public void setRowHeight(int heightPx)
Description copied from interface:SRangeSets row height in unit of pixel- Specified by:
setRowHeightin interfaceSRange
-
setRowHeight
public void setRowHeight(int heightPx, boolean custom)Description copied from interface:SRangeSets the height(in pixel) of row in this range, it effects to whole row.- Specified by:
setRowHeightin interfaceSRange- Parameters:
heightPx- width in pixelcustom- mark it as custom value
-
isWholeColumn
public boolean isWholeColumn()
Description copied from interface:SRangeCheck if this range cover an entire columns (form 0, and last row to the max available column of a sheet)- Specified by:
isWholeColumnin interfaceSRange
-
getColumns
public SRange getColumns()
Description copied from interface:SRangeReturns aSRangethat represent columns of the 1st selected area of this Range. Note that only the 1st selected area is considered if this Range is a multiple-selected Range.- Specified by:
getColumnsin interfaceSRange- Returns:
- a
SRangethat represent columns of this Range and contains all rows of the column.
-
setColumnWidth
public void setColumnWidth(int widthPx)
Description copied from interface:SRangeSets column width in unit of pixel- Specified by:
setColumnWidthin interfaceSRange
-
setColumnWidth
public void setColumnWidth(int widthPx, boolean custom)Description copied from interface:SRangeSets the width(in pixel) of column in this range, it effects to whole column.- Specified by:
setColumnWidthin interfaceSRange- Parameters:
widthPx- width in pixelcustom- mark it as custom value
-
getHyperlink
public SHyperlink getHyperlink()
Description copied from interface:SRangeReturns the hyperlink of this Range.- Specified by:
getHyperlinkin interfaceSRange- Returns:
- hyperlink of this Range
-
copy
public SRange copy(SRange dstRange, boolean cut)
Description copied from interface:SRangecut the selected range and paste to destination range.
-
copy
public SRange copy(SRange dstRange)
Description copied from interface:SRangeCopy data from this range to the specified destination range.
-
pasteSpecial
public SRange pasteSpecial(SRange dstRange, SRange.PasteType pasteType, SRange.PasteOperation pasteOp, boolean skipBlanks, boolean transpose)
Description copied from interface:SRangePastes to a destination Range from this range.- Specified by:
pasteSpecialin interfaceSRange- Parameters:
dstRange- the destination range to be pasted into.pasteType- the part of the range to be pasted.pasteOp- the paste operationskipBlanks- true to not have blank cells in the ranage to paste into destination Range; default false.transpose- true to transpose rows and columns when pasting to this range; default false.- Returns:
- real destination range that was pasted into.
-
pasteSpecial0
public SRange pasteSpecial0(SRange dstRange, PasteOption option)
-
insert
public void insert(SRange.InsertShift shift, SRange.InsertCopyOrigin copyOrigin)
Description copied from interface:SRangeInsert cells of this Range.- Specified by:
insertin interfaceSRange- Parameters:
shift- can beSRange.InsertShift.DEFAULT, {SRange.InsertShift.DOWN, orSRange.InsertShift.RIGHT.copyOrigin- from where to copy the format to the insert area(SRange.InsertCopyOrigin.FORMAT_LEFT_ABOVE/SRange.InsertCopyOrigin.FORMAT_RIGHT_BELOW)
-
delete
public void delete(SRange.DeleteShift shift)
Description copied from interface:SRangeDelete cells of this Range.- Specified by:
deletein interfaceSRange- Parameters:
shift- can beSRange.DeleteShift.DEFAULT, {SRange.DeleteShift.UP, orSRange.DeleteShift.LEFT.
-
merge
public void merge(boolean across)
Description copied from interface:SRangeMerge cells of this range into a merged cell.
-
unmerge
public void unmerge()
Description copied from interface:SRangeUn-merge a merged cell in this range to separated cells.
-
setBorders
public void setBorders(SRange.ApplyBorderType borderType, SBorder.BorderType lineStyle, String color)
Description copied from interface:SRangeAdds/Remove border of all cells within this range upon the specified border type.- Specified by:
setBordersin interfaceSRange- Parameters:
borderType- one ofSRange.ApplyBorderTypelineStyle- border line style, one ofSBorder.BorderTypecolor- color in HTML format; i.e., #rrggbb.
-
move
public void move(int nRow, int nCol)Description copied from interface:SRangeMove this range to a new place as specified by row offset (negative value to move up; positive value to move down) and column offset(negative value to move left; positive value to move right)
-
setCellStyle
public void setCellStyle(SCellStyle style)
Description copied from interface:SRangeSets a Style object to this Range.- Specified by:
setCellStylein interfaceSRange- Parameters:
style- the style object
-
getCellStyle
public SCellStyle getCellStyle()
Description copied from interface:SRangeGets the first(top-left) cell's style- Specified by:
getCellStylein interfaceSRange- Returns:
-
fill
public void fill(SRange dstRange, SRange.FillType fillType)
Description copied from interface:SRangePerform an auto fill on the specified destination Range. Note the given destination Range must include this source Range.
-
fillDown
public void fillDown()
Description copied from interface:SRangeFills down from the top cells of this Range to the rest of this Range.
-
fillLeft
public void fillLeft()
Description copied from interface:SRangeFills left from the rightmost cells of this Range to the rest of this Range.
-
fillRight
public void fillRight()
Description copied from interface:SRangeFills right from the leftmost cells of this Range to the rest of this Range.
-
fillUp
public void fillUp()
Description copied from interface:SRangeFills up from the bottom cells of this Range to the rest of this Range.
-
setHidden
public void setHidden(boolean hidden)
Description copied from interface:SRangeSets whether this rows or columns are hidden(useful only if this Range cover entire column or entire row)
-
setHiddenInLock
protected void setHiddenInLock(boolean hidden)
-
setDisplayGridlines
public void setDisplayGridlines(boolean show)
Description copied from interface:SRangeSets whether show the gridlines of the sheets in this Range.- Specified by:
setDisplayGridlinesin interfaceSRange- Parameters:
show- true to show the gridlines; false to not show the gridlines.
-
setHyperlink
public void setHyperlink(SHyperlink.HyperlinkType linkType, String address, String display)
Description copied from interface:SRangeSets the hyperlink of this Range- Specified by:
setHyperlinkin interfaceSRange- Parameters:
linkType- the type of target to link. One of theSHyperlink.HyperlinkType.URL,SHyperlink.HyperlinkType.DOCUMENT,SHyperlink.HyperlinkType.EMAIL,SHyperlink.HyperlinkType.FILEaddress- the addressdisplay- the text to display link
-
getValue
public Object getValue()
Description copied from interface:SRangeReturns left top cell value of this Range.
-
getValues
public List<Object> getValues()
Description copied from interface:SRangeReturns all cell values from left to right and top to bottom of this Range in one dimension list.
-
getOffset
public SRange getOffset(int rowOffset, int colOffset)
Description copied from interface:SRangeReturns aSRangethat represents a range that offset from this Range.- Specified by:
getOffsetin interfaceSRange- Parameters:
rowOffset- positive means downward; 0 means don't change row; negative means upward.colOffset- positive means rightward; 0 means don't change column; negative means leftward.- Returns:
- a
SRangethat represents a range that offset from this Range.
-
isAnyCellProtected
public boolean isAnyCellProtected()
Description copied from interface:SRangeReturns whether any cell is protected and locked in this Range.- Specified by:
isAnyCellProtectedin interfaceSRange- Returns:
- true if any cell is protected and locked in this Range.
-
deleteSheet
public void deleteSheet()
Description copied from interface:SRangeDelete sheet of this Range.- Specified by:
deleteSheetin interfaceSRange
-
createSheet
public SSheet createSheet(String name)
Description copied from interface:SRangeCreate sheet of this book as specified in this Range.- Specified by:
createSheetin interfaceSRange- Parameters:
name- the name of the new created sheet; null would use default "SheetX" name where X is the next sheet number.
-
cloneSheet
public SSheet cloneSheet(String name)
Description copied from interface:SRangeClone sheet as specified in this Range.- Specified by:
cloneSheetin interfaceSRange- Parameters:
name- the name of the new created sheet; null would use default "SheetX" name where X is the next sheet number.
-
setSheetName
public void setSheetName(String newname)
Description copied from interface:SRangeSet(Rename) the name of the sheet as specified in this Range.- Specified by:
setSheetNamein interfaceSRange
-
setSheetOrder
public void setSheetOrder(int pos)
Description copied from interface:SRangeSets the order of the sheet as specified in this Range.- Specified by:
setSheetOrderin interfaceSRange- Parameters:
pos- the position that we want to insert the sheet into (0 based)
-
setFreezePanel
public void setFreezePanel(int numOfRow, int numOfColumn)Description copied from interface:SRangeSet the freeze panel- Specified by:
setFreezePanelin interfaceSRange- Parameters:
numOfRow- the number of row to freeze, 0 means no freezenumOfColumn- the number of column to freeze, 0 means no freeze
-
getCellFormatText
public String getCellFormatText()
Description copied from interface:SRangeGets the first(top-left) cell's formatted text, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it will formats the value by transferred format (e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)- Specified by:
getCellFormatTextin interfaceSRange- Returns:
-
getCellDataFormat
public String getCellDataFormat()
Description copied from interface:SRangeGets the first(top-left) cell's format, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it transfer the format by LOCALE(e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)- Specified by:
getCellDataFormatin interfaceSRange- Returns:
-
isSheetProtected
public boolean isSheetProtected()
Description copied from interface:SRangeGets whether the sheet of the first region of this Range is protected.- Specified by:
isSheetProtectedin interfaceSRange- Returns:
-
validate
public SDataValidation validate(String editText)
Description copied from interface:SRangeReturns whether the plain text input by the end user is valid or not; note the validation only applies to the left-top cell of this Range.
-
findAutoFilterRange
public SRange findAutoFilterRange()
Description copied from interface:SRangeTo 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:
findAutoFilterRangein interfaceSRange- Returns:
- a range of cells for applying auto filter or null if can't find one from this Range.
-
enableAutoFilter
public SAutoFilter enableAutoFilter(boolean enable)
Description copied from interface:SRangeEnable the auto filter and return it, get null if you disable it.- Specified by:
enableAutoFilterin interfaceSRange- Returns:
- the autofilter if enable, or null if disable.
-
enableAutoFilter
public SAutoFilter enableAutoFilter(int field, SAutoFilter.FilterOp filterOp, Object criteria1, Object criteria2, Boolean visibleDropDown)
Description copied from interface:SRangeFilters a list specified by this Range and returns an AutoFilter object.- Specified by:
enableAutoFilterin interfaceSRange- Parameters:
field- offset of the field on which you want to base the filter on (1-based; i.e. leftmost column in this range is field 1).filterOp- , Use FILTEROP_AND and FILTEROP_OR with criteria1 and criterial2 to construct compound criteria.criteria1- "=" to find blank fields, "<>" to find non-blank fields. If null, means ALL. If filterOp == AutoFilter#FILTEROP_TOP10, then this shall specifies the number of items (e.g. "10").criteria2- 2nd criteria; used with criteria1 and filterOP to construct compound criteria.visibleDropDown- true to show the autoFilter drop-down arrow for the filtered field; false to hide the autoFilter drop-down arrow; null to keep as is.- Returns:
- the applied AutoFiltering
-
resetAutoFilter
public void resetAutoFilter()
Description copied from interface:SRangeReset the autofilter, clear the condition, shows all the hidden row- Specified by:
resetAutoFilterin interfaceSRange
-
applyAutoFilter
public void applyAutoFilter()
Description copied from interface:SRangeApply the autofilter with the old condition and current cell values- Specified by:
applyAutoFilterin interfaceSRange
-
notifyCustomEvent
public void notifyCustomEvent(String customEventName, Object data, boolean writelock)
Description copied from interface:SRangeSend a custom model event to all book's listener, the event name must not conflict with that inModelEvents- Specified by:
notifyCustomEventin interfaceSRange- Parameters:
customEventName- the event custom eventdata- the datawritelock- use write lock when notify , set true if the synchronized book listener will modify the book.
-
addPicture
public SPicture addPicture(ViewAnchor anchor, byte[] image, SPicture.Format format)
Description copied from interface:SRangeAdd a picture into the sheet of this Range- Specified by:
addPicturein interfaceSRange- Returns:
- the created picture
-
deletePicture
public void deletePicture(SPicture picture)
Description copied from interface:SRangeDelete an existing picture from the sheet of this Range.- Specified by:
deletePicturein interfaceSRange- Parameters:
picture- the picture to be deleted
-
movePicture
public void movePicture(SPicture picture, ViewAnchor anchor)
Description copied from interface:SRangeUpdate picture anchor. Can be used to resize or move a picture.- Specified by:
movePicturein interfaceSRange- Parameters:
picture- the picture to changeanchor- the new anchor
-
addChart
public SChart addChart(ViewAnchor anchor, SChart.ChartType type, SChart.ChartGrouping grouping, SChart.ChartLegendPosition pos, boolean isThreeD)
Description copied from interface:SRangeAdd a chart into the sheet of this Range
-
deleteChart
public void deleteChart(SChart chart)
Description copied from interface:SRangeDelete an existing chart from the sheet of this Range.- Specified by:
deleteChartin interfaceSRange- Parameters:
chart- the chart to be deleted
-
moveChart
public void moveChart(SChart chart, ViewAnchor anchor)
Description copied from interface:SRangeMove the chart to the new anchor.
-
updateChart
public void updateChart(SChart chart)
Description copied from interface:SRangeNotify the model that a chart contains change, for example, chart data changes.- Specified by:
updateChartin interfaceSRange- Parameters:
chart- the chart that changes
-
sort
public void sort(SRange key1, boolean descending1, SRange.SortDataOption dataOption1, SRange key2, boolean descending2, SRange.SortDataOption dataOption2, SRange key3, boolean descending3, SRange.SortDataOption dataOption3, int hasHeader, boolean matchCase, boolean sortByRows)
Description copied from interface:SRangeSort this Range according the specified parameters- Specified by:
sortin interfaceSRange- Parameters:
key1- key1 for sortingdescending1- true to do descending sort; false to do ascending sort for key1.dataOption1- see numeric String as number or not for key1.key2- key2 for sortingdescending2- true to do descending sort; false to do ascending sort for key2.dataOption2- see numeric String as number or not for key2.key3- key3 for sortingdescending3- true to do descending sort; false to do ascending sort for key3.dataOption3- see numeric String as number or not for key3.hasHeader- whether sort range includes headermatchCase- true to match the string cases; false to ignore string casessortByRows- true to sort by rows(change columns orders); false to sort by columns(change row orders).
-
createName
public void createName(String nameName)
Description copied from interface:SRangeCreate aSNamethat refer to this range.- Specified by:
createNamein interfaceSRange- Parameters:
nameName- name of theSNamethat you can refer in formulas.
-
isProtected
public boolean isProtected()
Description copied from interface:SRangeGets the first region's protection status; return true if the sheet of the first region is protected and some cells in the region is locked.- Specified by:
isProtectedin interfaceSRange
-
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:SRangeProtect aSSheetso that it cannot be modified.- Specified by:
protectSheetin interfaceSRange- Parameters:
password- a case-sensitive password for the sheet; null means sheet is not password protected.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.
-
unprotectSheet
public boolean unprotectSheet(String password)
Description copied from interface:SRangeRemoves protection from a sheet. This method has no effect if the sheet isn't protected.- Specified by:
unprotectSheetin interfaceSRange- 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 SSheetProtection getSheetProtection()
Description copied from interface:SRangeGetsSSheetProtectionprotection options that tells what are allowed operations for the protected sheet of the first region of this range.- Specified by:
getSheetProtectionin interfaceSRange- Returns:
-
setValidation
public void setValidation(SDataValidation.ValidationType validationType, boolean ignoreBlank, SDataValidation.OperatorType operatorType, boolean inCellDropDown, String formula1, String formula2, boolean showInput, String inputTitle, String inputMessage, boolean showError, SDataValidation.AlertStyle alertStyle, String errorTitle, String errorMessage)
Description copied from interface:SRangeAdd if not exist or modify an existingSDataValidationto this range.- Specified by:
setValidationin interfaceSRange- 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<SDataValidation> getValidations()
Description copied from interface:SRangeGetsSDataValidations associated with this range; if more than one validation is present, will return at most two.
-
deleteValidation
public void deleteValidation()
Description copied from interface:SRangeDelete theSDataValidationassociated in the specified range.- Specified by:
deleteValidationin interfaceSRange
-
getOrCreateFont
public SFont getOrCreateFont(SFont.Boldweight boldweight, String htmlColor, int fontHeight, String fontName, boolean italic, boolean strikeout, SFont.TypeOffset typeOffset, SFont.Underline underline)
Description copied from interface:SRangeGet font if exists or create font if not exists from the book of this range and return it.- Specified by:
getOrCreateFontin interfaceSRange- Returns:
- font of the specified font metrics
-
refresh
public void refresh(boolean includeDependants)
Description copied from interface:SRangeEvaluate(if not cached), update data model, and refresh UI of this range and its dependent cells if the includeDependents is true.
-
refresh
public void refresh(boolean includeDependants, boolean clearCache, boolean enforceEval)Description copied from interface:SRangeUpdate 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.
-
setAutoRefresh
public boolean setAutoRefresh(boolean auto)
Description copied from interface:SRangeTurn on(true)/off(false) of auto refresh of this range and return previous on/off status; default is true.- Specified by:
setAutoRefreshin interfaceSRange- Parameters:
auto- whether refresh automatically- Returns:
- previous status
-
setSheetVisible
public void setSheetVisible(SRange.SheetVisible visible)
Description copied from interface:SRangeSet Sheet visibility; can be SheetVisible.VISIBLE, SheetVisible.HIDDEN, and SheetVisible.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:
setSheetVisiblein interfaceSRange- See Also:
SRange.SheetVisible
-
setCommentRichText
public void setCommentRichText(String html)
Description copied from interface:SRangeSet comment rich text into the left top cell of this range; null to delete it.- Specified by:
setCommentRichTextin interfaceSRange
-
getCommentRichText
public String getCommentRichText()
Description copied from interface:SRangeReturn the comment rich edit text of the left top cell of this Range.- Specified by:
getCommentRichTextin interfaceSRange- Returns:
- the rich edit text of this Range.
-
setCommentVisible
public void setCommentVisible(boolean visible)
Description copied from interface:SRangeSet comment visibility into the left top cell of this range; if no comment at the cell, it simply ignored.- Specified by:
setCommentVisiblein interfaceSRange
-
isCommentVisible
public boolean isCommentVisible()
Description copied from interface:SRangeReturns 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:
isCommentVisiblein interfaceSRange- Returns:
-
setNameName
public void setNameName(String namename, String newname)
Description copied from interface:SRangeSet(Rename) the name of the Name(or Table) as specified in this Range(a Book or a Sheet).- Specified by:
setNameNamein interfaceSRange- Parameters:
namename- name of the Name(or Table)newname- new name for the Name(or Table)
-
setStringValue
public void setStringValue(String value)
Description copied from interface:SRangeSave the specified value into this range as a String no matter the value is prefixed with '=' or not.- Specified by:
setStringValuein interfaceSRange
-
getMergedRegion
public CellRegion getMergedRegion()
Description copied from interface:SRangeReturns the merged region of the left top cell of this Range if any; otherwise, returns null if not a merged region.- Specified by:
getMergedRegionin interfaceSRange- Returns:
- the merged region of the left top cell of this Range if any
-
getDataRegion
public CellRegion getDataRegion()
Description copied from interface:SRangeReturns the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.- Specified by:
getDataRegionin interfaceSRange- Returns:
- the region which contains data(including chart, picture, and fills) in the sheet of this Range; return null if empty sheet.
-
cloneSheetFrom
public SSheet cloneSheetFrom(String name, SSheet sheet)
Description copied from interface:SRangeClone 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:
cloneSheetFromin interfaceSRange- 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:
SRange.cloneSheetFrom(String, SSheet, boolean)
-
cloneSheetFrom
public SSheet cloneSheetFrom(String name, SSheet sheet, boolean valueOnly)
Description copied from interface:SRangeClone 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:
cloneSheetFromin interfaceSRange- 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 cell value only- Returns:
- the new created sheet
-
getDirectPrecedents
public Set<SRange> getDirectPrecedents()
Description copied from interface:SRangeReturns 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:
getDirectPrecedentsin interfaceSRange- Returns:
- the direct precedents
-
getPrecedents
public Set<SRange> getPrecedents()
Description copied from interface:SRangeReturns 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:
getPrecedentsin interfaceSRange- Returns:
- all direct or indirect precedents
-
getDirectDependents
public Set<SRange> getDirectDependents()
Description copied from interface:SRangeReturns 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:
getDirectDependentsin interfaceSRange- Returns:
- the direct dependents
-
getDependents
public Set<SRange> getDependents()
Description copied from interface:SRangeReturns 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:
getDependentsin interfaceSRange- Returns:
- all direct or indirect dependents
-
group
public void group()
Description copied from interface:SRangeGroups 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:SRangeUngroups the rows or columns by matching the range, which decreases their outline level.Note: The minimum level is down to 0.
-
getRowGroups
public List<SRange> getRowGroups()
Description copied from interface:SRangeReturns all group ranges for rows, which intersect with this range.- Specified by:
getRowGroupsin interfaceSRange- Returns:
- an empty list if not matched.
-
getRowGroups
public List<SRange> getRowGroups(int outlineLevel)
Description copied from interface:SRangeReturns all group ranges matched the given outline level for rows, which intersect with this range.- Specified by:
getRowGroupsin interfaceSRange- Parameters:
outlineLevel- a valid value in a range is from 1 to 7 (inclusive).- Returns:
- an empty list if not matched.
-
getRowGroups
public List<SRange> getRowGroups(int fromOutlineLevel, int toOutlineLevel)
Description copied from interface:SRangeReturns all group ranges matched between fromOutlineLevel and toOutlineLevel for rows, which intersect with this range.- Specified by:
getRowGroupsin interfaceSRange- Parameters:
fromOutlineLevel- 1~7 (inclusive)toOutlineLevel- 2~8 (exclusive)- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<SRange> getColumnGroups()
Description copied from interface:SRangeReturns all group ranges for columns, which intersect with this range.- Specified by:
getColumnGroupsin interfaceSRange- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<SRange> getColumnGroups(int outlineLevel)
Description copied from interface:SRangeReturns all group ranges matched the given outline level for columns, which intersect with this range.- Specified by:
getColumnGroupsin interfaceSRange- Parameters:
outlineLevel- a valid value in a range is from 1 to 7 (inclusive).- Returns:
- an empty list if not matched.
-
getColumnGroups
public List<SRange> getColumnGroups(int fromOutlineLevel, int toOutlineLevel)
Description copied from interface:SRangeReturns all group ranges matched between fromOutlineLevel and toOutlineLevel for columns, which intersect with this range.- Specified by:
getColumnGroupsin interfaceSRange- 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:SRangeSets 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:
setSummaryBelowin interfaceSRange- Parameters:
summaryBelow- true to display as below for rows.
-
isSummaryBelow
public boolean isSummaryBelow()
Description copied from interface:SRangeReturns whether to display group summary as below for rows.Default:
true- Specified by:
isSummaryBelowin interfaceSRange
-
setSummaryRight
public void setSummaryRight(boolean summaryRight)
Description copied from interface:SRangeSets 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:
setSummaryRightin interfaceSRange- Parameters:
summaryRight- true to display as right for columns.
-
isSummaryRight
public boolean isSummaryRight()
Description copied from interface:SRangeReturns whether to display group summary as right for columns.Default:
true- Specified by:
isSummaryRightin interfaceSRange
-
collapse
public void collapse()
Description copied from interface:SRangeCollapses one group by matching with the 1st selected area of this Range in rows or columns. (not affected its descendant).
-
expand
public void expand()
Description copied from interface:SRangeExpands one group by matching with the 1st selected area of this Range in rows or columns. (not affected its descendant).
-
clearOutlineLevel
public void clearOutlineLevel()
Description copied from interface:SRangeClears all outline level for all groups that intersect with the range.2:4for rows andC:Efor columns- Specified by:
clearOutlineLevelin interfaceSRange
-
isCollapsed
public boolean isCollapsed()
Description copied from interface:SRangeReturns whether the group by matching with the 1st selected area of this Range in rows or columns, which has collapsed or not. Otherwise, returns false instead.- Specified by:
isCollapsedin interfaceSRange
-
getOutlineLevel
public int getOutlineLevel()
Description copied from interface:SRangeReturns the outline level of the group by matching with the 1st selected area of this Range in rows or columns. Otherwise, returns 0 instead.- Specified by:
getOutlineLevelin interfaceSRange
-
-