AddComment

function AddComment(sText: string = null, sAuthor: string = null, sUserId: string = null): ApiComment

Description

Adds a comment to the current selection of the document, or to the current word if there is no text selection

Parameters

sTextstringdefault: null

The comment text (required).

sAuthorstringdefault: null

The author's name (optional).

sUserIdstringdefault: null

The user ID of the comment author (optional).

Returns

ApiComment

Try It

var oDocument = Api.GetDocument(); 
var oParagraph = oDocument.GetElement(0); 
oParagraph.AddText("This is just a sample text.");
oParagraph.AddLineBreak();
oParagraph.AddText("The comment was added to this document.");
oDocument.AddComment("This is a comment to the document.", "Jane");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).