跳到主要内容

GetCommentById

通过 ID 从当前文档返回批注。

语法

expression.GetCommentById(sId);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
sId必需string批注 ID。

返回值

ApiComment

示例

通过 ID 获取电子表格中当前文档的批注。

// How to get specific comment by its ID in a spreadsheet.

// Find a comment by its ID in a spreadsheet.

let comment = Api.AddComment("Comment", "Bob");
let id = comment.GetId();
comment = Api.GetCommentById(id);
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("Comment Text: " + comment.GetText());
worksheet.GetRange("B1").SetValue("Comment Author: " + comment.GetAuthorName());