[]
Sheets.ThreadedComments.ThreadedComment
• new ThreadedComment()
支持添加、读取、更新、删除回复和序列化的评论对象。
▸ add(reply): null | IReply
添加回复。如果未提供回复,将使用当前用户的ID和当前时间。
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 |
要添加的回复。 |
null | IReply
▸ all(replies?): IReply[]
获取或设置所有回复;当提供数组时,将它们添加到当前评论中。
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 | Description |
|---|---|---|
replies? |
IReply[] |
Replies to append. |
IReply[]
▸ col(): number
获取嵌套评论的列。
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
按索引获取回复。
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 |
回复索引的从零开始。 |
undefined | IReply
▸ remove(index): null | IReply
按索引删除回复。
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 |
回复索引。 |
null | IReply
▸ resolved(resolved?): boolean
获取或设置评论是否已解决。
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 | Description |
|---|---|---|
resolved? |
boolean |
若提供该参数,则设置已解决状态;否则返回当前状态。 |
boolean
▸ row(): number
获取 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
更新回复的内容和元数据。
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 |
IReply |
新回复。 |
void