# GC.Spread.Sheets.Range

## Content

# Class: Range

[Spread](../modules/GC.Spread).[Sheets](../modules/GC.Spread.Sheets).Range

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Range#constructor)

### Properties

- [col](GC.Spread.Sheets.Range#col)
- [colCount](GC.Spread.Sheets.Range#colcount)
- [row](GC.Spread.Sheets.Range#row)
- [rowCount](GC.Spread.Sheets.Range#rowcount)

### Methods

- [contains](GC.Spread.Sheets.Range#contains)
- [containsRange](GC.Spread.Sheets.Range#containsrange)
- [equals](GC.Spread.Sheets.Range#equals)
- [getIntersect](GC.Spread.Sheets.Range#getintersect)
- [intersect](GC.Spread.Sheets.Range#intersect)
- [offset](GC.Spread.Sheets.Range#offset)
- [union](GC.Spread.Sheets.Range#union)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new Range**(`r`, `c`, `rc`, `cc`)

Represents a range, which is described by the row index, column index, row count, and column count.

**`example`**
```
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
var rule = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
rule.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
rule.ranges([new GC.Spread.Sheets.Range(0,0,5,1)]);
rule.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between);
rule.style(style);
rule.value1(2);
rule.value2(100);
activeSheet.conditionalFormats.addRule(rule);
activeSheet.setValue(0,0,1,3);
activeSheet.setValue(1,0,45,3);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `r` | `number` | The row index. |
| `c` | `number` | The column index. |
| `rc` | `number` | The row count. |
| `cc` | `number` | The column count. |

## Properties

### <a id="col" name="col"></a> col

• **col**: `number`

The column index.

**`example`**
```
var cellrange = new GC.Spread.Sheets.Range();
cellrange.col = 0;
cellrange.row = 1;
cellrange.colCount = 1;
cellrange.rowCount = 8;
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
activeSheet.setSparkline(13, 0, cellrange, GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting);
```

___

### <a id="colcount" name="colcount"></a> colCount

• **colCount**: `number`

The column count.

**`example`**
```
var cellrange = new GC.Spread.Sheets.Range();
cellrange.col = 0;
cellrange.row = 1;
cellrange.colCount = 1;
cellrange.rowCount = 8;
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
activeSheet.setSparkline(13, 0, cellrange, GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting);
```

___

### <a id="row" name="row"></a> row

• **row**: `number`

The row index.

**`example`**
```
var cellrange = new GC.Spread.Sheets.Range();
cellrange.col = 0;
cellrange.row = 1;
cellrange.colCount = 1;
cellrange.rowCount = 8;
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
activeSheet.setSparkline(13, 0, cellrange, GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting);
```

___

### <a id="rowcount" name="rowcount"></a> rowCount

• **rowCount**: `number`

The row count.

**`example`**
```
var cellrange = new GC.Spread.Sheets.Range();
cellrange.col = 0;
cellrange.row = 1;
cellrange.colCount = 1;
cellrange.rowCount = 8;
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
activeSheet.setSparkline(13, 0, cellrange, GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting);
```

## Methods

### <a id="contains" name="contains"></a> contains

▸ **contains**(`row`, `col`, `rowCount?`, `colCount?`): `boolean`

Gets whether the current range contains the specified cell.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | The row index. |
| `col` | `number` | The column index. |
| `rowCount?` | `number` | The row count. |
| `colCount?` | `number` | The column count. |

#### Returns

`boolean`

`true` if the range contains the cell; otherwise, `false`.

___

### <a id="containsrange" name="containsrange"></a> containsRange

▸ **containsRange**(`range`): `boolean`

Gets whether the current range contains the specified range.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `range` | [`Range`](GC.Spread.Sheets.Range) | The cell range. |

#### Returns

`boolean`

`true` if the current range contains the specified cell range; otherwise, `false`.

___

### <a id="equals" name="equals"></a> equals

▸ **equals**(`range`): `boolean`

Gets whether the current range is equal to the specified range.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `range` | [`Range`](GC.Spread.Sheets.Range) | The range to compare. |

#### Returns

`boolean`

`true` if the current range is equal to the specified range; otherwise, `false`.

___

### <a id="getintersect" name="getintersect"></a> getIntersect

▸ **getIntersect**(`range`, `maxRowCount`, `maxColumnCount`): [`Range`](GC.Spread.Sheets.Range)

Gets the intersection of two cell ranges.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `range` | [`Range`](GC.Spread.Sheets.Range) | The cell range. |
| `maxRowCount` | `number` | The maximum row count. |
| `maxColumnCount` | `number` | The maximum column count. |

#### Returns

[`Range`](GC.Spread.Sheets.Range)

Returns null if there is no intersection, or the cell range of the intersection.

___

### <a id="intersect" name="intersect"></a> intersect

▸ **intersect**(`row`, `col`, `rowCount`, `colCount`): `boolean`

Gets whether the current range intersects with the one specified by the row and column index and the row and column count.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | The row index. |
| `col` | `number` | The column index. |
| `rowCount` | `number` | The row count. |
| `colCount` | `number` | The column count. |

#### Returns

`boolean`

`true` if the specified range intersects with the current range; otherwise `false`.

___

### <a id="offset" name="offset"></a> offset

▸ **offset**(`x`, `y`): [`Range`](GC.Spread.Sheets.Range)

Offsets the location of the range by the specified coordinates.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `x` | `number` | The offset along the <i>x</i>-axis. |
| `y` | `number` | The offset along the <i>y</i>-axis. |

#### Returns

[`Range`](GC.Spread.Sheets.Range)

The new location.

___

### <a id="union" name="union"></a> union

▸ **union**(`range`): [`Range`](GC.Spread.Sheets.Range)

Joins this range with the specified range as a union.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `range` | [`Range`](GC.Spread.Sheets.Range) | The target range. |

#### Returns

[`Range`](GC.Spread.Sheets.Range)

Returns the union of the ranges.
