跳到主要内容

AddComment

返回 ApiComment 对象的数组。

语法

expression.AddComment(sText, sAuthor);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
sText必需string批注文本。
sAuthor必需string作者姓名(可选)。

返回值

ApiComment | null

示例

在电子表格中向单元格附加带有作者名称的批注。

// How do I add a comment to a cell in a spreadsheet?

// Annotate a cell with reviewer notes and display the comment text in a spreadsheet.

Api.AddComment("Comment 1", "Bob");
Api.AddComment("Comment 2");
let comments = Api.GetComments();
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("Comment Text: " + comments[0].GetText());
worksheet.GetRange("B1").SetValue("Comment Author: " + comments[0].GetAuthorName());