跳到主要内容

GetCommentById

Returns a comment from the current document by its ID.

Syntax

expression.GetCommentById(sId);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sIdRequiredstringThe comment ID.

Returns

ApiComment

Example

This example shows how to get a comment from the current document 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());