UnionRange
UnionRange class
Represents union range.
class UnionRange;
Methods
Method | Description |
---|---|
getFirstRow() | Gets the index of the first row of the range. |
getFirstColumn() | Gets the index of the first column of the range. |
getRowCount() | Gets the count of rows in the range. |
getColumnCount() | Gets the count of rows in the range. |
getValue() | Gets and sets the values of the range. |
setValue(object) | Gets and sets the values of the range. |
getName() | Gets or sets the name of the range. |
setName(string) | Gets or sets the name of the range. |
getRefersTo() | Gets the range’s refers to. |
getHasRange() | Indicates whether this has range. |
getHyperlinks() | Gets all hyperlink in the range. |
getCellCount() | Gets all cell count in the range. |
getRangeCount() | Gets the count of the ranges. |
getRanges() | Gets all union ranges. |
merge() | Combines a range of cells into a single cell. |
unMerge() | Unmerges merged cells of this range. |
putValue(string, boolean, boolean) | Puts a value into the range, if appropriate the value will be converted to other data type and cell’s number format will be reset. |
setStyle(Style) | Sets the style of the range. |
applyStyle(Style, StyleFlag) | Applies formats for a whole range. |
copy(UnionRange, PasteOptions) | Copying the range with paste special options. |
getEnumerator() | Gets the enumerator for cells in this Range. |
setOutlineBorders(CellBorderType[], Color[]) | Sets out line borders around a range of cells. |
setOutlineBorders(CellBorderType, Color) | Sets the outline borders around a range of cells with same border style and color. |
intersect(string) | Intersects another range. |
intersect(UnionRange) | Intersects another range. |
intersect(Range[]) | Intersects another range. |
union(string) | Union another range. |
union(UnionRange) | Union another range. |
union(Range[]) | Union the ranges. |
isNull() | Checks whether the implementation object is null. |
getFirstRow()
Gets the index of the first row of the range.
getFirstRow() : number;
Remarks
Only effects when it only contains one range.
getFirstColumn()
Gets the index of the first column of the range.
getFirstColumn() : number;
Remarks
Only effects when it only contains one range.
getRowCount()
Gets the count of rows in the range.
getRowCount() : number;
Remarks
Only effects when it only contains one range.
getColumnCount()
Gets the count of rows in the range.
getColumnCount() : number;
Remarks
Only effects when it only contains one range.
getValue()
Gets and sets the values of the range.
getValue() : object;
setValue(object)
Gets and sets the values of the range.
setValue(value: object) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | object | The value to set. |
getName()
Gets or sets the name of the range.
getName() : string;
Remarks
Named range is supported. For example,
range.Name = “Sheet1!MyRange”;
setName(string)
Gets or sets the name of the range.
setName(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
Remarks
Named range is supported. For example,
range.Name = “Sheet1!MyRange”;
getRefersTo()
Gets the range’s refers to.
getRefersTo() : string;
getHasRange()
Indicates whether this has range.
getHasRange() : boolean;
getHyperlinks()
Gets all hyperlink in the range.
getHyperlinks() : Hyperlink[];
Returns
getCellCount()
Gets all cell count in the range.
getCellCount() : number;
getRangeCount()
Gets the count of the ranges.
getRangeCount() : number;
getRanges()
Gets all union ranges.
getRanges() : Range[];
Returns
Range[]
merge()
Combines a range of cells into a single cell.
merge() : void;
Remarks
Reference the merged cell via the address of the upper-left cell in the range.
unMerge()
Unmerges merged cells of this range.
unMerge() : void;
putValue(string, boolean, boolean)
Puts a value into the range, if appropriate the value will be converted to other data type and cell’s number format will be reset.
putValue(stringValue: string, isConverted: boolean, setStyle: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
stringValue | string | Input value |
isConverted | boolean | True: converted to other data type if appropriate. |
setStyle | boolean | True: set the number format to cell’s style when converting to other data type |
setStyle(Style)
Sets the style of the range.
setStyle(style: Style) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
style | Style | The Style object. |
applyStyle(Style, StyleFlag)
Applies formats for a whole range.
applyStyle(style: Style, flag: StyleFlag) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
style | Style | The style object which will be applied. |
flag | StyleFlag | Flags which indicates applied formatting properties. |
Remarks
Each cell in this range will contains a Style object. So this is a memory-consuming method. Please use it carefully.
copy(UnionRange, PasteOptions)
Copying the range with paste special options.
copy(range: UnionRange, options: PasteOptions) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
range | UnionRange | The source range. |
options | PasteOptions | The paste special options. |
getEnumerator()
Gets the enumerator for cells in this Range.
getEnumerator() : CellEnumerator;
Returns
The cells enumerator
Remarks
When traversing elements by the returned Enumerator, the cells collection should not be modified(such as operations that will cause new Cell/Row be instantiated or existing Cell/Row be deleted). Otherwise the enumerator may not be able to traverse all cells correctly(some elements may be traversed repeatedly or skipped).
setOutlineBorders(CellBorderType[], Color[])
Sets out line borders around a range of cells.
setOutlineBorders(borderStyles: CellBorderType[], borderColors: Color[]) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
borderStyles | CellBorderType[] | Border styles. |
borderColors | Color[] | Border colors. |
Remarks
Both the length of borderStyles and borderStyles must be 4. The order of borderStyles and borderStyles must be top,bottom,left,right
setOutlineBorders(CellBorderType, Color)
Sets the outline borders around a range of cells with same border style and color.
setOutlineBorders(borderStyle: CellBorderType, borderColor: Color) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
borderStyle | CellBorderType | Border style. |
borderColor | Color | Border color. |
intersect(string)
Intersects another range.
intersect(range: string) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
range | string | The range. |
Returns
Remarks
If the two union ranges are not intersected, returns null.
intersect(UnionRange)
Intersects another range.
intersect(unionRange: UnionRange) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
unionRange | UnionRange | The range. |
Returns
Remarks
If the two union ranges are not intersected, returns null.
intersect(Range[])
Intersects another range.
intersect(ranges: Range[]) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
ranges | Range[] | The range. |
Returns
Remarks
If the two union ranges are not intersected, returns null.
union(string)
Union another range.
union(range: string) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
range | string | The range. |
Returns
union(UnionRange)
Union another range.
union(unionRange: UnionRange) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
unionRange | UnionRange | The range. |
Returns
union(Range[])
Union the ranges.
union(ranges: Range[]) : UnionRange;
Parameters:
Parameter | Type | Description |
---|---|---|
ranges | Range[] | The ranges. |
Returns
isNull()
Checks whether the implementation object is null.
isNull() : boolean;