Skip to Content
ClassesFTheadCommentBuilder

Class: FTheadCommentBuilder

A builder for thread comment. use FUniver univerAPI.newTheadComment() to create a new builder.

Extends

  • FTheadCommentItem

Constructors

new FTheadCommentBuilder()

new FTheadCommentBuilder(comment?): FTheadCommentBuilder

Parameters

ParameterType
comment?IThreadComment

Returns

FTheadCommentBuilder

Inherited from

FTheadCommentItem.constructor

Accessors

content

Get Signature

get content(): RichTextValue

Get the content of the comment

Example
const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const content = comment.content;
Returns

RichTextValue

The content of the comment

Inherited from

FTheadCommentItem.content

dateTime

Get Signature

get dateTime(): string

Get the date time of the comment

Example
const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const dateTime = comment.dateTime;
Returns

string

The date time of the comment

Inherited from

FTheadCommentItem.dateTime

id

Get Signature

get id(): string

Get the id of the comment

Example
const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const id = comment.id;
Returns

string

The id of the comment

Inherited from

FTheadCommentItem.id

personId

Get Signature

get personId(): string

Get the person id of the comment

Example
const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const personId = comment.personId;
Returns

string

The person id of the comment

Inherited from

FTheadCommentItem.personId

threadId

Get Signature

get threadId(): string

Get the thread id of the comment

Example
const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const threadId = comment.threadId;
Returns

string

The thread id of the comment

Inherited from

FTheadCommentItem.threadId

Methods

build()

build(): IThreadComment

Build the comment

Returns

IThreadComment

The comment

Example

const comment = univerAPI.newTheadComment() .setContent(univerAPI.newRichText().insertText('hello zhangsan')) .build();

copy()

copy(): FTheadCommentBuilder

Copy the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.getActiveWorkbook() .getSheetById(sheetId) .getCommentById(commentId); const newComment = comment.copy();

Inherited from

FTheadCommentItem.copy

setContent()

setContent(content): FTheadCommentBuilder

Set the content of the comment

Parameters

ParameterTypeDescription
contentanyThe content of the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.newTheadComment() .setContent(univerAPI.newRichText().insertText('hello zhangsan'));

setDateTime()

setDateTime(date): FTheadCommentBuilder

Set the date time of the comment

Parameters

ParameterTypeDescription
dateDateThe date time of the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.newTheadComment() .setDateTime(new Date());

setId()

setId(id): FTheadCommentBuilder

Set the id of the comment

Parameters

ParameterTypeDescription
idstringThe id of the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.newTheadComment() .setId('123');

setPersonId()

setPersonId(userId): FTheadCommentBuilder

Set the person id of the comment

Parameters

ParameterTypeDescription
userIdstringThe person id of the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.newTheadComment() .setPersonId('123');

setThreadId()

setThreadId(threadId): FTheadCommentBuilder

Set the thread id of the comment

Parameters

ParameterTypeDescription
threadIdstringThe thread id of the comment

Returns

FTheadCommentBuilder

The comment builder

Example

const comment = univerAPI.newTheadComment() .setThreadId('123');

create()

static create(comment?): FTheadCommentBuilder

Create a new FTheadCommentItem

Parameters

ParameterTypeDescription
comment?IThreadCommentThe comment

Returns

FTheadCommentBuilder

A new instance of FTheadCommentItem

Example

const comment = univerAPI.newTheadComment();

Overrides

FTheadCommentItem.create