跳到主要内容

ShowComment

通过 ID 显示批注。

语法

expression.ShowComment(commentId);

expression - 表示 ApiDocument 类的变量。

参数

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

返回值

boolean

示例

此示例展示如何通过 ID 显示批注。

const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
paragraph.AddText('This text has a comment attached to it.');

const range = paragraph.GetRange();
const comment = range.AddComment('Please review this section.', 'John');

if (comment) {
doc.ShowComment(comment.GetId());
const resultParagraph = Api.CreateParagraph();
const author = comment.GetAuthorName();
resultParagraph.AddText('Comment by ' + author + ' is now displayed.');
doc.Push(resultParagraph);
}