跳到主要内容

AddComment

向当前段落添加批注。 💡 请注意,此段落必须在文档中。

语法

expression.AddComment(sText, sAuthor, sUserId);

expression - 表示 ApiParagraph 类的变量。

参数

名称必需/可选数据类型默认值描述
sText必需string批注文本。
sAuthor可选string作者姓名。
sUserId可选string批注作者的用户 ID。

返回值

ApiComment

示例

在文档中向段落添加批注。

// How to add a comment with an author to the paragraph in a document.

// Add the comment and display the result in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample paragraph.");
paragraph.AddLineBreak();
paragraph.AddText("The comment was added to this document.");
paragraph.AddComment("comment", "Jane");