# GC.Spread.Sheets.ThreadedComments.ThreadedComment

## Content

# Class: ThreadedComment

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

## Table of contents

### Constructors

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

### Methods

- [add](GC.Spread.Sheets.ThreadedComments.ThreadedComment#add)
- [all](GC.Spread.Sheets.ThreadedComments.ThreadedComment#all)
- [col](GC.Spread.Sheets.ThreadedComments.ThreadedComment#col)
- [get](GC.Spread.Sheets.ThreadedComments.ThreadedComment#get)
- [remove](GC.Spread.Sheets.ThreadedComments.ThreadedComment#remove)
- [resolved](GC.Spread.Sheets.ThreadedComments.ThreadedComment#resolved)
- [row](GC.Spread.Sheets.ThreadedComments.ThreadedComment#row)
- [set](GC.Spread.Sheets.ThreadedComments.ThreadedComment#set)

## Constructors

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

• **new ThreadedComment**()

Threaded comment object that supports adding, reading, updating, removing replies and serialization.

## Methods

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

▸ **add**(`reply`): ``null`` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

Add a reply. If the reply is not provided, the current user's id and the current time will be used.

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

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `reply` | [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply) | Reply to add. |

#### Returns

``null`` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

___

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

▸ **all**(`replies?`): [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)[]

Get or set all replies; when an array is provided, append them to the current thread.

**`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 |
| :------ | :------ |
| `replies?` | [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)[] |

#### Returns

[`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)[]

___

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

▸ **col**(): `number`

Get the column of the threaded comment.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const col = tc.col();
console.log(col);
```

#### Returns

`number`

___

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

▸ **get**(`index`): `undefined` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

Get a reply by index.

**`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 reply = tc.get(0);
console.log(reply);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | Zero-based reply index. |

#### Returns

`undefined` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

___

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

▸ **remove**(`index`): ``null`` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

Remove a reply by index.

**`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' }] });
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'world' }] });
tc.remove(0);
console.log(tc.get(0));
```

#### Parameters

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

#### Returns

``null`` \| [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply)

___

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

▸ **resolved**(`resolved?`): `boolean`

Get or set whether the thread is resolved.

**`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' }] });
tc.resolved(true);
console.log(tc.resolved());
```

#### Parameters

| Name | Type |
| :------ | :------ |
| `resolved?` | `boolean` |

#### Returns

`boolean`

___

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

▸ **row**(): `number`

Get the row of the threaded comment.

**`example`**
```javascript
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const row = tc.row();
console.log(row);
```

#### Returns

`number`

___

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

▸ **set**(`index`, `reply`): `void`

Update a reply's content and metadata.

**`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' }] });
tc.set(0, { message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello, world' }] });
console.log(tc.get(0));
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | Reply index. |
| `reply` | [`IReply`](../interfaces/GC.Spread.Sheets.ThreadedComments.IReply) | New reply. |

#### Returns

`void`
