AddComment
Adds a comment to the current range.
Syntax
expression.AddComment(sText, sAuthor, sUserId);
expression
- A variable that represents a ApiRange class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
sText | Required | string | The comment text (required). | |
sAuthor | Required | string | The author's name (optional). | |
sUserId | Required | string | The user ID of the comment author (optional). |
Returns
Example
This example adds a comment to the range.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("Document");
let range = doc.GetRange(0, 7);
range.AddText("ONLYOFFICE ", "before");
range.AddText(" Builder", "after");
range.AddComment("comment", "John Smith");