GetAllComments
返回当前工作簿中的所有批注,包括所有工作表中的批注。
语法
expression.GetAllComments();
expression - 表示 Api 类的变量。
参数
此方法没有任何参数。
返回值
示例
将所有工作表的每个批注收集到电子表格中的一个列表中。
// How do I retrieve all comments that exist anywhere in a spreadsheet?
// Gather every annotation added by any author in a spreadsheet.
let worksheet = Api.GetActiveSheet();Api.AddComment("Comment 1", "John Smith");
worksheet.GetRange("A4").AddComment("Comment 2", "Mark Potato");
let arrComments = Api.GetAllComments();
worksheet.GetRange("A1").SetValue("Comment text: " + arrComments[1].GetText());
worksheet.GetRange("A2").SetValue("Comment author: " + arrComments[1].GetAuthorName());