AddComment
function AddComment(
oElement: ApiRun[] | DocumentElement = null,
sText: string = null,
sAuthor: string = null,
sUserId: string = null,
): ApiComment
Description
Adds a comment to the specifed document element or array of Runs.
Parameters
The element where the comment will be added. It may be applied to any element which has the AddComment method.
- sText
string
null The comment text (required).
- sAuthor
string
null The author's name (optional).
- sUserId
string
null The user ID of the comment author (optional).
Returns
ApiComment
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
Api.AddComment(oParagraph, "ONLYOFFICE for developers", "Jane");