AddComment

AddComment(sText, sAuthor, sUserId) → { ApiComment }

Adds a comment to the current run. Please note that this run must be in the document.

Parameters:

Name Type Description
sText string

The comment text (required).

sAuthor string

The author's name (optional).

sUserId string

The user ID of the comment author (optional).

Returns:

Type
ApiComment

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun = Api.CreateRun();
oRun.AddText("This is just a sample text. Nothing special.");
oParagraph.AddElement(oRun);
oRun.AddComment("comment", "John Smith", "uid-1");
builder.SaveFile("docx", "AddComment.docx");
builder.CloseFile();

Resulting document