Skip to Content
ClassesFThreadComment

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

IDocumentBody

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

FRange

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

FThreadComment[]

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

ParameterTypeDescription
commentFTheadCommentBuilderThe 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

ParameterType
resolved?boolean

Returns

Promise<boolean>

Deprecated

use resolveAsync as instead


resolveAsync()

resolveAsync(resolved?): Promise<boolean>

Resolve the comment

Parameters

ParameterTypeDescription
resolved?booleanWhether 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

ParameterType
contentIDocumentBody

Returns

Promise<boolean>

Deprecated

use updateAsync as instead


updateAsync()

updateAsync(content): Promise<boolean>

Update the comment content

Parameters

ParameterTypeDescription
contentanyThe 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'));