API Reference

FThreadComment

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

Access

Access through:

Setup

Register @univerjs/sheets-thread-comment or a preset that includes it. In plugin mode, import @univerjs/sheets-thread-comment/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs/sheets-thread-comment

FThreadComment.deleteAsync

Delete the comment and it's replies

TypeScript
deleteAsync(): Promise<boolean>

Returns

Whether the comment is deleted successfully

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()// Delete the first commentconst result = await comments[0]?.deleteAsync()console.log(result)

Types: Promise

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.getCommentData

Get the comment data

TypeScript
getCommentData(): IBaseComment

Returns

The comment data

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()comments.forEach((comment) => {  console.log(comment.getCommentData())})

Types: IBaseComment

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.getIsRoot

Whether the comment is a root comment

TypeScript
getIsRoot(): boolean

Returns

Whether the comment is a root comment

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()comments.forEach((comment) => {  console.log(comment.getIsRoot())})

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.getRange

Get the range of the comment

TypeScript
getRange(): FRange | null

Returns

The range of the comment

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()comments.forEach((comment) => {  console.log(comment.getRange().getA1Notation())})

Types: FRange

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.getReplies

Get the replies of the comment

TypeScript
getReplies(): FThreadComment[] | undefined

Returns

The loaded replies, or undefined when the thread or its replies are unavailable.

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()comments.forEach((comment) => {  if (comment.getIsRoot()) {    const replies = comment.getReplies()    replies.forEach((reply) => {      console.log(reply.getCommentData())    })  }})

Types: FThreadComment

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.getRichText

Get the rich text of the comment

TypeScript
getRichText(): RichTextValue

Returns

The rich text of the comment

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')const comments = fWorksheet.getComments()comments.forEach((comment) => {  console.log(comment.getRichText())})

Types: RichTextValue

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.replyAsync

Reply to the comment

TypeScript
replyAsync(comment: FTheadCommentBuilder): Promise<boolean>

Parameters

  • comment — Required. The comment to reply to

Returns

Whether the comment is replied successfully

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')// Create a new commentconst richText = univerAPI.newRichText().insertText('hello univer')const commentBuilder = univerAPI.newTheadComment().setContent(richText).setId('mock-comment-id')const cell = fWorksheet.getRange('A1')await cell.addCommentAsync(commentBuilder)// Reply to the commentconst replyText = univerAPI.newRichText().insertText('Hello Univer AI')const reply = univerAPI.newTheadComment().setContent(replyText)const comment = fWorksheet.getCommentById('mock-comment-id')const result = await comment.replyAsync(reply)console.log(result)

Types: Promise · FTheadCommentBuilder

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.resolveAsync

Resolve the comment

TypeScript
resolveAsync(resolved?: boolean): Promise<boolean>

Parameters

  • resolved — Optional. Whether the comment is resolved

Returns

Set the comment to resolved or not operation result

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')// Create a new commentconst richText = univerAPI.newRichText().insertText('hello univer')const commentBuilder = univerAPI.newTheadComment().setContent(richText).setId('mock-comment-id')const cell = fWorksheet.getRange('A1')await cell.addCommentAsync(commentBuilder)// Resolve the comment after 3 secondssetTimeout(async () => {  const comment = fWorksheet.getCommentById('mock-comment-id')  const result = await comment.resolveAsync(true)  console.log(result)}, 3000)

Types: Promise

Package: @univerjs/sheets-thread-comment · Type definitions

FThreadComment.updateAsync

Update the comment content

TypeScript
updateAsync(content: IDocumentBody | RichTextValue): Promise<boolean>

Parameters

  • content — Required. The new content of the comment

Returns

Whether the comment is updated successfully

Examples

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')if (!fWorksheet) throw new Error('fWorksheet is not available')// Create a new commentconst richText = univerAPI.newRichText().insertText('hello univer')const commentBuilder = univerAPI.newTheadComment().setContent(richText).setId('mock-comment-id')const cell = fWorksheet.getRange('A1')await cell.addCommentAsync(commentBuilder)// Update the comment after 3 secondssetTimeout(async () => {  const comment = fWorksheet.getCommentById('mock-comment-id')  const newRichText = univerAPI.newRichText().insertText('Hello Univer AI')  const result = await comment.updateAsync(newRichText)  console.log(result)}, 3000)

Types: Promise · IDocumentBody · RichTextValue

Package: @univerjs/sheets-thread-comment · Type definitions

How is this guide?

© 2026 DreamNum Co., Ltd.