[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
在线咨询 立即试用
(Showing Draft Content)

GC.Spread.Sheets.ThreadedComments.ThreadedComment

Class: ThreadedComment

Sheets.ThreadedComments.ThreadedComment

Table of contents

Constructors

Methods

Constructors

constructor

• new ThreadedComment()

支持添加、读取、更新、删除回复和序列化的评论对象。

Methods

add

▸ add(reply): null | IReply

添加回复。如果未提供回复,将使用当前用户的ID和当前时间。

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 要添加的回复。

Returns

null | IReply


all

▸ all(replies?): IReply[]

获取或设置所有回复;当提供数组时,将它们添加到当前评论中。

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 Description
replies? IReply[] Replies to append.

Returns

IReply[]


col

▸ col(): number

获取嵌套评论的列。

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

按索引获取回复。

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 回复索引的从零开始。

Returns

undefined | IReply


remove

▸ remove(index): null | IReply

按索引删除回复。

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 回复索引。

Returns

null | IReply


resolved

▸ resolved(resolved?): boolean

获取或设置评论是否已解决。

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 Description
resolved? boolean 若提供该参数,则设置已解决状态;否则返回当前状态。

Returns

boolean


row

▸ row(): number

获取 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

更新回复的内容和元数据。

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 IReply 新回复。

Returns

void