Class: FThreadComment
A class that represents a thread comment already in the sheet.
Methods
delete()
delete(): Promise<boolean>
Returns
Promise
<boolean
>
Deprecated
use deleteAsync
as instead.
deleteAsync()
deleteAsync(): Promise<boolean>
Delete the comment and it’s replies
Returns
Promise
<boolean
>
success or not
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const success = await comment.deleteAsync();
getCommentData()
getCommentData(): IBaseComment
Get the comment data
Returns
IBaseComment
The comment data
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const commentData = comment.getCommentData();
getContent()
getContent(): IDocumentBody
Returns
Deprecated
use getRichText
as instead
getIsRoot()
getIsRoot(): boolean
Whether the comment is a root comment
Returns
boolean
Whether the comment is a root comment
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const isRoot = comment.getIsRoot();
getRange()
getRange(): FRange
Get the range of the comment
Returns
The range of the comment
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const range = comment.getRange();
getReplies()
getReplies(): FThreadComment[]
Get the replies of the comment
Returns
the replies of the comment
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const replies = comment.getReplies();
getRichText()
getRichText(): RichTextValue
Get the rich text of the comment
Returns
RichTextValue
The rich text of the comment
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const richText = comment.getRichText();
replyAsync()
replyAsync(comment): Promise<boolean>
Reply to the comment
Parameters
Parameter | Type | Description |
---|---|---|
comment | FTheadCommentBuilder | The comment to reply to |
Returns
Promise
<boolean
>
success or not
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const reply = univerAPI.newTheadComment()
.setContent(univerAPI.newRichText().insertText('hello zhangsan'));
const success = await comment.replyAsync(reply);
resolve()
resolve(resolved?): Promise<boolean>
Parameters
Parameter | Type |
---|---|
resolved ? | boolean |
Returns
Promise
<boolean
>
Deprecated
use resolveAsync
as instead
resolveAsync()
resolveAsync(resolved?): Promise<boolean>
Resolve the comment
Parameters
Parameter | Type | Description |
---|---|---|
resolved ? | boolean | Whether the comment is resolved |
Returns
Promise
<boolean
>
success or not
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const success = await comment.resolveAsync(true);
update()
update(content): Promise<boolean>
Parameters
Parameter | Type |
---|---|
content | IDocumentBody |
Returns
Promise
<boolean
>
Deprecated
use updateAsync
as instead
updateAsync()
updateAsync(content): Promise<boolean>
Update the comment content
Parameters
Parameter | Type | Description |
---|---|---|
content | any | The new content of the comment |
Returns
Promise
<boolean
>
success or not
Example
const comment = univerAPI.getActiveWorkbook()
.getSheetById(sheetId)
.getCommentById(commentId);
const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));