Skip to Content
ClassesFThreadComment

类: FThreadComment

A class that represents a thread comment already in the sheet.

方法

delete()

delete(): Promise<boolean>

返回

Promise<boolean>

已被弃用

use deleteAsync as instead.


deleteAsync()

deleteAsync(): Promise<boolean>

Delete the comment and it’s replies

返回

Promise<boolean>

success or not

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const success = await comment.deleteAsync();

getCommentData()

getCommentData(): IBaseComment

Get the comment data

返回

IBaseComment

The comment data

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const commentData = comment.getCommentData();

getContent()

getContent(): IDocumentBody

返回

IDocumentBody

已被弃用

use getRichText as instead


getIsRoot()

getIsRoot(): boolean

Whether the comment is a root comment

返回

boolean

Whether the comment is a root comment

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const isRoot = comment.getIsRoot();

getRange()

getRange(): FRange

Get the range of the comment

返回

FRange

The range of the comment

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const range = comment.getRange();

getReplies()

getReplies(): FThreadComment[]

Get the replies of the comment

返回

FThreadComment[]

the replies of the comment

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const replies = comment.getReplies();

getRichText()

getRichText(): RichTextValue

Get the rich text of the comment

返回

RichTextValue

The rich text of the comment

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const richText = comment.getRichText();

replyAsync()

replyAsync(comment): Promise<boolean>

Reply to the comment

参数

参数类型描述
commentFTheadCommentBuilderThe comment to reply to

返回

Promise<boolean>

success or not

示例

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>

参数

参数类型
resolved?boolean

返回

Promise<boolean>

已被弃用

use resolveAsync as instead


resolveAsync()

resolveAsync(resolved?): Promise<boolean>

Resolve the comment

参数

参数类型描述
resolved?booleanWhether the comment is resolved

返回

Promise<boolean>

success or not

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const success = await comment.resolveAsync(true);

update()

update(content): Promise<boolean>

参数

参数类型
contentIDocumentBody

返回

Promise<boolean>

已被弃用

use updateAsync as instead


updateAsync()

updateAsync(content): Promise<boolean>

Update the comment content

参数

参数类型描述
contentanyThe new content of the comment

返回

Promise<boolean>

success or not

示例

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));