[]
        
(Showing Draft Content)

GC.Spread.Sheets.ThreadedComments.ThreadedComment

Class: ThreadedComment

Sheets.ThreadedComments.ThreadedComment

Table of contents

Constructors

Methods

Constructors

constructor

new ThreadedComment()

Threaded comment object that supports adding, reading, updating, removing replies and serialization.

Methods

add

add(reply): null | IReply

Add a reply. If the reply is not provided, the current user's id and the current time will be used.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const reply = tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
console.log(reply);

Parameters

Name Type Description
reply IReply Reply to add.

Returns

null | IReply


all

all(replies?): IReply[]

Get or set all replies; when an array is provided, append them to the current thread.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
const allReplies = tc.all();
console.log(allReplies);

Parameters

Name Type
replies? IReply[]

Returns

IReply[]


col

col(): number

Get the column of the threaded comment.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const col = tc.col();
console.log(col);

Returns

number


get

get(index): undefined | IReply

Get a reply by index.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
const reply = tc.get(0);
console.log(reply);

Parameters

Name Type Description
index number Zero-based reply index.

Returns

undefined | IReply


remove

remove(index): null | IReply

Remove a reply by index.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'world' }] });
tc.remove(0);
console.log(tc.get(0));

Parameters

Name Type Description
index number Reply index.

Returns

null | IReply


resolved

resolved(resolved?): boolean

Get or set whether the thread is resolved.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
tc.resolved(true);
console.log(tc.resolved());

Parameters

Name Type
resolved? boolean

Returns

boolean


row

row(): number

Get the row of the threaded comment.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
const row = tc.row();
console.log(row);

Returns

number


set

set(index, reply): void

Update a reply's content and metadata.

example

const activeSheet = spread.getActiveSheet();
const threadedCommentManager = activeSheet.threadedComments;
const tc = threadedCommentManager.add(1, 1);
tc.add({ message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello' }] });
tc.set(0, { message: [{ type: GC.Spread.Sheets.ThreadedComments.ContentType.text, value: 'hello, world' }] });
console.log(tc.get(0));

Parameters

Name Type Description
index number Reply index.
reply IReply New reply.

Returns

void