跳到主要内容

AddComment

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

语法

expression.AddComment(sText, sAuthor, sUserId);

expression - 表示 ApiRun 类(文本块)的变量。

参数

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

返回值

ApiComment

示例

此示例向文本块添加批注。

// How to comment a specific text.

// Insert a comment into the run and add an author to it.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text. Nothing special.");
paragraph.AddElement(run);
run.AddComment("comment", "John Smith");