AddComment
Adds a comment to the current document selection, or to the current word if no text is selected.
Syntax
expression.AddComment(sText, sAuthor, sUserId);
expression - A variable that represents a ApiDocument class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| sText | Required | string | The comment text. | |
| sAuthor | Optional | string | The author's name. | |
| sUserId | Optional | string | The user ID of the comment author. |
Returns
Example
This example adds a comment to the document.
- Code
- Result
// How to comment the document.
// Add comment to the document indicating the author.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text.");
paragraph.AddLineBreak();
paragraph.AddText("The comment was added to this document.");
doc.AddComment("This is a comment to the document.", "Jane");