Get Started
Usage API
More information

AddComment

AddComment(sText, sAutor) → { ApiComment }

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

Parameters:

Name Type Description
sText string

The comment text (required).

sAutor string

The author's name (optional).

Returns:

Type
ApiComment

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is just a sample paragraph.");
oParagraph.AddLineBreak();
oParagraph.AddText("The comment was added to this document.");
oParagraph.AddComment("comment", "Jane");
builder.SaveFile("docx", "AddComment.docx");
builder.CloseFile();

Resulting document