Methods

applyStyle(style, flag)

Applies formats for a whole range. Each cell in this range will contains a Style object. So this is a memory-consuming method. Please use it carefully.

Parameters

Name Type Optional Description

style

Style

 

The style object which will be applied.

flag

StyleFlag

 

Flags which indicates applied formatting properties.

autoFill(target)

Automaticall fill the target range.

Parameter

Name Type Optional Description

target

Range

 

the target range.

autoFill(target, autoFillType)

Automaticall fill the target range.

Parameters

Name Type Optional Description

target

Range

 

The targed range.

autoFillType

Number

 

AutoFillType

copy(range, options)

Copying the range with paste special options.

Parameters

Name Type Optional Description

range

Range

 

The source range.

options

PasteOptions

 

The paste special options.

copy(range)

Copies data (including formulas), formatting, drawing objects etc. from a source range.

Parameter

Name Type Optional Description

range

Range

 

Source

copyData(range)

Copies cell data (including formulas) from a source range.

Parameter

Name Type Optional Description

range

Range

 

Source

copyStyle(range)

Copies style settings from a source range.

Parameter

Name Type Optional Description

range

Range

 

Source

copyValue(range)

Copies cell value from a source range.

Parameter

Name Type Optional Description

range

Range

 

Source

get(rowOffset, columnOffset) → Cell

Gets Cell object in this range.

Parameters

Name Type Optional Description

rowOffset

Number

 

Row offset in this range, zero based.

columnOffset

Number

 

Column offset in this range, zero based.

Returns

Cell Cell object.

getAddress()

Gets address of the range.

getCellCount()

Gets all cell count in the range. NOTE: This property is now obsolete. Instead, please use RowCount and ColumnCount to get total cells count. This property will be removed 12 months later since February 2021. Aspose apologizes for any inconvenience you may have experienced.

getCellOrNull(rowOffset, columnOffset) → Cell

Gets Cell object or null in this range.

Parameters

Name Type Optional Description

rowOffset

Number

 

Row offset in this range, zero based.

columnOffset

Number

 

Column offset in this range, zero based.

Returns

Cell Cell object.

getColumnCount()

Gets the count of columns in the range.

getColumnWidth()

Sets or gets the column width of this range

getCurrentRegion()

Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns.

getEntireColumn()

Gets a Range object that represents the entire column (or columns) that contains the specified range.

getEntireRow()

Gets a Range object that represents the entire row (or rows) that contains the specified range.

getFirstColumn()

Gets the index of the first column of the range.

getFirstRow()

Gets the index of the first row of the range.

Gets all hyperlink in the range.

getName()

Gets or sets the name of the range. Named range is supported. For example, range.Name = "Sheet1!MyRange";

getOffset(rowOffset, columnOffset) → Range

Gets Range range by offset.

Parameters

Name Type Optional Description

rowOffset

Number

 

Row offset in this range, zero based.

columnOffset

Number

 

Column offset in this range, zero based.

Returns

Range 

getRefersTo()

Gets the range's refers to.

getRowCount()

Gets the count of rows in the range.

getRowHeight()

Sets or gets the height of rows in this range

getValue()

Gets and sets the value of the range. If the range contains multiple cells, return a two-dimension System.Array object. If applies object array to the range, it should be a two-dimension System.Array object.

getWorksheet()

Gets the Worksheetobject which contains this range.

intersect(range) → Range

Returns a Range object that represents the rectangular intersection of two ranges. If the two ranges are not intersected, returns null.

Parameter

Name Type Optional Description

range

Range

 

The intersecting range.

Returns

Range a Range object

isIntersect(range) → boolean

Indicates whether the range is intersect. If the two ranges area not in the same worksheet ,return false.

Parameter

Name Type Optional Description

range

Range

 

The range.

Returns

boolean Whether the range is intersect.

iterator()

Gets the enumerator for cells in this Range. 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).@return {Iterator} The cells enumerator

merge()

Combines a range of cells into a single cell. Reference the merged cell via the address of the upper-left cell in the range.

moveTo(destRow, destColumn)

Move the current range to the dest range.

Parameters

Name Type Optional Description

destRow

Number

 

The start row of the dest range.

destColumn

Number

 

The start column of the dest range.

putValue(stringValue, isConverted, setStyle)

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.

Parameters

Name Type Optional 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

setColumnWidth()

Sets or gets the column width of this range

setName()

Gets or sets the name of the range. Named range is supported. For example, range.Name = "Sheet1!MyRange";

setOutlineBorder(borderEdge, borderStyle, borderColor)

Sets outline border around a range of cells.

Parameters

Name Type Optional Description

borderEdge

Number

 

BorderType

borderStyle

Number

 

CellBorderType

borderColor

Color

 

Border color.

setOutlineBorders(borderStyle, borderColor)

Sets the outline borders around a range of cells with same border style and color.

Parameters

Name Type Optional Description

borderStyle

Number

 

CellBorderType

borderColor

Color

 

Border color.

setOutlineBorders(borderStyles, borderColors)

Sets out line borders around a range of cells. Both the length of borderStyles and borderStyles must be 4. The order of borderStyles and borderStyles must be top,bottom,left,right

Parameters

Name Type Optional Description

borderStyles

Array of Number

 

Border styles.

borderColors

Array of Color

 

Border colors.

setRowHeight()

Sets or gets the height of rows in this range

setStyle(style)

Sets the style of the range.

Parameter

Name Type Optional Description

style

Style

 

The Style object.

setValue()

Gets and sets the value of the range. If the range contains multiple cells, return a two-dimension System.Array object. If applies object array to the range, it should be a two-dimension System.Array object.

toString() → String

Returns a string represents the current Range object.

Returns

String 

union(range) → ArrayList

Returns the union of two ranges.

Parameter

Name Type Optional Description

range

Range

 

The range

Returns

ArrayList The union of two ranges.

unMerge()

Unmerges merged cells of this range.