跳到主要内容

GetCommentById

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

语法

expression.GetCommentById(sId);

expression - 表示 Api 类的变量。

参数

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

返回值

ApiComment

示例

此示例演示如何根据 ID 从当前文档获取批注。

// How to get specific comment by its ID.

// Find a comment by its ID.

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());