# GC.Spread.Sheets.Outlines.Outline

## Content

# Class: Outline

[Sheets](../modules/GC.Spread.Sheets).[Outlines](../modules/GC.Spread.Sheets.Outlines).Outline

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Outlines.Outline#constructor)

### Methods

- [direction](GC.Spread.Sheets.Outlines.Outline#direction)
- [expand](GC.Spread.Sheets.Outlines.Outline#expand)
- [expandGroup](GC.Spread.Sheets.Outlines.Outline#expandgroup)
- [find](GC.Spread.Sheets.Outlines.Outline#find)
- [getCollapsed](GC.Spread.Sheets.Outlines.Outline#getcollapsed)
- [getLevel](GC.Spread.Sheets.Outlines.Outline#getlevel)
- [getMaxLevel](GC.Spread.Sheets.Outlines.Outline#getmaxlevel)
- [getState](GC.Spread.Sheets.Outlines.Outline#getstate)
- [group](GC.Spread.Sheets.Outlines.Outline#group)
- [isCollapsed](GC.Spread.Sheets.Outlines.Outline#iscollapsed)
- [isGroupEnd](GC.Spread.Sheets.Outlines.Outline#isgroupend)
- [refresh](GC.Spread.Sheets.Outlines.Outline#refresh)
- [resumeAdding](GC.Spread.Sheets.Outlines.Outline#resumeadding)
- [setCollapsed](GC.Spread.Sheets.Outlines.Outline#setcollapsed)
- [suspendAdding](GC.Spread.Sheets.Outlines.Outline#suspendadding)
- [ungroup](GC.Spread.Sheets.Outlines.Outline#ungroup)
- [ungroupRange](GC.Spread.Sheets.Outlines.Outline#ungrouprange)

## Constructors

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

• **new Outline**(`count`)

Represents an outline (range group) for the worksheet.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `count` | `number` | The number of rows or columns. |

## Methods

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

▸ **direction**(`direction?`): `any`

Gets or sets the outline's (range group) direction.

**`example`**
```javascript
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(3,2);
activeSheet.columnOutlines.group(4,1);
activeSheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.forward);
activeSheet.resumePaint();
```

#### Parameters

| Name | Type |
| :------ | :------ |
| `direction?` | [`OutlineDirection`](../enums/GC.Spread.Sheets.Outlines.OutlineDirection) |

#### Returns

`any`

If no value is set, returns the outline's (range group) direction; otherwise, returns the outline.

___

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

▸ **expand**(`level`, `expand`): `void`

Expands all outlines (range groups), using the specified level.

**`example`**
```javascript
//This example uses the expand method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.expand(0,false);
activeSheet.resumePaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `level` | `number` | The level of the outline to expand or collapse. |
| `expand` | `boolean` | Whether to expand the groups. |

#### Returns

`void`

___

### <a id="expandgroup" name="expandgroup"></a> expandGroup

▸ **expandGroup**(`groupInfo`, `expand`): `void`

Expands or collapses the specified outline (range group) of rows or columns.

**`example`**
```javascript
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(2, 5);
var groupInfo = activeSheet.rowOutlines.find(2, 0);
activeSheet.rowOutlines.expandGroup(groupInfo, false);
activeSheet.resumePaint(); // the group is created and collapsed now.
activeSheet.rowOutlines.expandGroup(groupInfo, true); // the group and expand now.
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `groupInfo` | [`OutlineInfo`](GC.Spread.Sheets.Outlines.OutlineInfo) | The group information of the range group. |
| `expand` | `boolean` | Whether to expand the groups. |

#### Returns

`void`

___

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

▸ **find**(`index`, `level`): [`OutlineInfo`](GC.Spread.Sheets.Outlines.OutlineInfo)

Gets the outline (range group) with the specified group level and row or column index.

**`example`**
```javascript
//This example uses the find method.
activeSheet.rowOutlines.group(0,5);
var rgi = activeSheet.rowOutlines.find(1, 0);
rgi.state(GC.Spread.Sheets.Outlines.OutlineState.collapsed);
spread.invalidateLayout();
spread.repaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index of the row or column. |
| `level` | `number` | The level of the outline (range group). |

#### Returns

[`OutlineInfo`](GC.Spread.Sheets.Outlines.OutlineInfo)

The specified range group.

___

### <a id="getcollapsed" name="getcollapsed"></a> getCollapsed

▸ **getCollapsed**(`index`): `boolean`

Gets the collapsed internal.

**`example`**
```javascript
//This example uses the getCollapsed method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.expand(0,true);
activeSheet.resumePaint();
alert(activeSheet.rowOutlines.isCollapsed(0));
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index. |

#### Returns

`boolean`

`true` if collapsed; otherwise, `false`.

___

### <a id="getlevel" name="getlevel"></a> getLevel

▸ **getLevel**(`index`): `number`

Gets the level of a specified row or column.
The level's index is zero-based.

**`example`**
```javascript
//This example uses the getLevel method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.expand(0,true);
activeSheet.resumePaint();
alert(activeSheet.rowOutlines.getLevel(0));
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index of the row or column. |

#### Returns

`number`

The level for the row or column.

___

### <a id="getmaxlevel" name="getmaxlevel"></a> getMaxLevel

▸ **getMaxLevel**(): `number`

Gets the number of the deepest level.

**`remarks`** The level index is zero-based.

**`example`**
```javascript
//This example uses the getMaxLevel method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.group(1,4);
activeSheet.rowOutlines.expand(0,true);
activeSheet.columnOutlines.group(0,1);
activeSheet.resumePaint();
alert(activeSheet.rowOutlines.getMaxLevel());
```

#### Returns

`number`

The number of the deepest level.

___

### <a id="getstate" name="getstate"></a> getState

▸ **getState**(`groupInfo`): [`OutlineState`](../enums/GC.Spread.Sheets.Outlines.OutlineState)

Gets the state for the specified group.

**`example`**
```javascript
//This example uses the getState method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
var rgi = activeSheet.rowOutlines.find(1, 0);
rgi.state(GC.Spread.Sheets.Outlines.OutlineState.collapsed);
alert(activeSheet.rowOutlines.getState(rgi));
activeSheet.resumePaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `groupInfo` | [`OutlineInfo`](GC.Spread.Sheets.Outlines.OutlineInfo) | The group information. |

#### Returns

[`OutlineState`](../enums/GC.Spread.Sheets.Outlines.OutlineState)

The group state.

___

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

▸ **group**(`index`, `count`): `void`

Groups a range of rows or columns into an outline (range group) from a specified start index.

**`example`**
```javascript
//This example uses the group method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.expand(0,false);
activeSheet.resumePaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The group starting index. |
| `count` | `number` | The number of rows or columns to group. |

#### Returns

`void`

___

### <a id="iscollapsed" name="iscollapsed"></a> isCollapsed

▸ **isCollapsed**(`index`): `boolean`

Determines whether the range group at the specified index is collapsed.

**`example`**
```javascript
//This example uses the isCollapsed method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.expand(0,true);
activeSheet.resumePaint();
alert(activeSheet.rowOutlines.isCollapsed(0));
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index of the row or column in the range group. |

#### Returns

`boolean`

`true` if the specified row or column is collapsed; otherwise, `false`.

___

### <a id="isgroupend" name="isgroupend"></a> isGroupEnd

▸ **isGroupEnd**(`index`, `processLevel`): `boolean`

Determines whether the specified index is the end of the group.

**`example`**
```javascript
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(2, 5);
activeSheet.rowOutlines.group(3, 2);
activeSheet.resumePaint();

console.log(activeSheet.rowOutlines.isGroupEnd(2, 0)); // false
console.log(activeSheet.rowOutlines.isGroupEnd(4, 0)); // false
console.log(activeSheet.rowOutlines.isGroupEnd(4, 1)); // true
console.log(activeSheet.rowOutlines.isGroupEnd(6, 0)); // true
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index. |
| `processLevel` | `number` | The process level. |

#### Returns

`boolean`

`true` if the specified index is the end of the group; otherwise, `false`.

___

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

▸ **refresh**(): `void`

Refreshes this range group.

#### Returns

`void`

___

### <a id="resumeadding" name="resumeadding"></a> resumeAdding

▸ **resumeAdding**(): `void`

Resumes the adding group when the row/column is inserting the group range.

**`example`**
```javascript
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(2, 5);
activeSheet.resumePaint();

console.log(activeSheet.rowOutlines.find(3, 0).end); // 6
console.log(activeSheet.rowOutlines.find(5, 0).end); // 6
activeSheet.addRows(4, 1);
console.log(activeSheet.rowOutlines.find(3, 0).end); // 7
console.log(activeSheet.rowOutlines.find(5, 0).end); // 7

activeSheet.rowOutlines.suspendAdding();
activeSheet.addRows(4, 1);
console.log(activeSheet.rowOutlines.find(3, 0).end); // 3 // cause adding suspended, the group spilt into two parts.
console.log(activeSheet.rowOutlines.find(5, 0).end); // 8
activeSheet.rowOutlines.resumeAdding();
```

#### Returns

`void`

___

### <a id="setcollapsed" name="setcollapsed"></a> setCollapsed

▸ **setCollapsed**(`index`, `collapsed`): `void`

Sets the collapsed level.

**`example`**
```javascript
//This example uses the setCollapsed method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.setCollapsed(0,false);
activeSheet.resumePaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index. |
| `collapsed` | `boolean` | Set to `true` to collapse the level. |

#### Returns

`void`

___

### <a id="suspendadding" name="suspendadding"></a> suspendAdding

▸ **suspendAdding**(): `void`

Suspends the adding group when the row/column is inserting the group range.

**`example`**
```javascript
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(2, 5);
activeSheet.resumePaint();

console.log(activeSheet.rowOutlines.find(3, 0).end); // 6
console.log(activeSheet.rowOutlines.find(5, 0).end); // 6
activeSheet.addRows(4, 1);
console.log(activeSheet.rowOutlines.find(3, 0).end); // 7
console.log(activeSheet.rowOutlines.find(5, 0).end); // 7

activeSheet.rowOutlines.suspendAdding();
activeSheet.addRows(4, 1);
console.log(activeSheet.rowOutlines.find(3, 0).end); // 3 // cause adding suspended, the group spilt into two parts.
console.log(activeSheet.rowOutlines.find(5, 0).end); // 8
activeSheet.rowOutlines.resumeAdding();
```

#### Returns

`void`

___

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

▸ **ungroup**(): `void`

Removes all outlines (range groups).

**`example`**
```javascript
//This example uses the ungroup method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.ungroup();
activeSheet.resumePaint();
```

#### Returns

`void`

___

### <a id="ungrouprange" name="ungrouprange"></a> ungroupRange

▸ **ungroupRange**(`index`, `count`): `void`

Removes a range of rows or columns from the outline (range group) at the specified start index.

**`example`**
```javascript
//This example uses the ungroupRange method.
activeSheet.suspendPaint();
activeSheet.rowOutlines.group(0,5);
activeSheet.rowOutlines.ungroupRange(0,1);
activeSheet.resumePaint();
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The group starting index. |
| `count` | `number` | The number of rows or columns to remove. |

#### Returns

`void`
