# GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager

## Content

# Class: ThreadedCommentManager

[Sheets](../modules/GC.Spread.Sheets).[ThreadedComments](../modules/GC.Spread.Sheets.ThreadedComments).ThreadedCommentManager

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#constructor)

### Methods

- [add](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#add)
- [all](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#all)
- [clear](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#clear)
- [get](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#get)
- [remove](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#remove)
- [size](GC.Spread.Sheets.ThreadedComments.ThreadedCommentManager#size)

## Constructors

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

• **new ThreadedCommentManager**()

Represent a threaded comment manager for adding, retrieving, removing, enumerating and serializing threaded comments on a worksheet.

## Methods

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

▸ **add**(`row`, `col`, `replies?`): ``null`` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

Add a threaded comment to the specified cell.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
const allReplies = tc.all();
console.log(allReplies);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | Row index. |
| `col` | `number` | Column index. |
| `replies?` | [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)[] | - |

#### Returns

``null`` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

The threaded comment instance.

___

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

▸ **all**(): [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)[]

Get all threaded comments on the worksheet in an array.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const allComments = threadedCommentManager.all();
console.log(allComments);
```

#### Returns

[`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)[]

___

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

▸ **clear**(`range?`): `void`

Clear the threaded comments in the specified range. When the range is not specified, it clears all the threaded comments in the sheet.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
threadedCommentManager.clear(new GC.Spread.Sheets.Range(1, 1, 3, 3));
```

#### Parameters

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

#### Returns

`void`

___

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

▸ **get**(`row`, `col`): `undefined` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

Get the threaded comment at the specified cell.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const threadedComment = threadedCommentManager.get(1, 1);
console.log(threadedComment);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | Row index. |
| `col` | `number` | Column index. |

#### Returns

`undefined` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

___

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

▸ **remove**(`row`, `col`): `undefined` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

Remove the threaded comment at the specified cell.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
threadedCommentManager.remove(1, 1);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | Row index. |
| `col` | `number` | Column index. |

#### Returns

`undefined` \| [`ThreadedComment`](GC.Spread.Sheets.ThreadedComments.ThreadedComment)

___

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

▸ **size**(): `number`

Get the number of threaded comments on the worksheet.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const size = threadedCommentManager.size();
console.log(size);
```

#### Returns

`number`
