[]
Sheets.ThreadedComments.ThreadedComment
• new ThreadedComment()
Threaded comment object that supports adding, reading, updating, removing replies and serialization.
▸ add(reply): null | IReply
Add a reply. If the reply is not provided, the current user's id and the current time will be used.
example
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);
| Name | Type | Description |
|---|---|---|
reply |
IReply |
Reply to add. |
null | IReply
▸ all(replies?): IReply[]
Get or set all replies; when an array is provided, append them to the current thread.
example
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);
| Name | Type |
|---|---|
replies? |
IReply[] |
IReply[]
▸ col(): number
Get the column of the threaded comment.
example
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const col = tc.col();
console.log(col);
number
▸ get(index): undefined | IReply
Get a reply by index.
example
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);
| Name | Type | Description |
|---|---|---|
index |
number |
Zero-based reply index. |
undefined | IReply
▸ remove(index): null | IReply
Remove a reply by index.
example
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));
| Name | Type | Description |
|---|---|---|
index |
number |
Reply index. |
null | IReply
▸ resolved(resolved?): boolean
Get or set whether the thread is resolved.
example
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());
| Name | Type |
|---|---|
resolved? |
boolean |
boolean
▸ row(): number
Get the row of the threaded comment.
example
const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const row = tc.row();
console.log(row);
number
▸ set(index, reply): void
Update a reply's content and metadata.
example
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));
| Name | Type | Description |
|---|---|---|
index |
number |
Reply index. |
reply |
IReply |
New reply. |
void