Get Started
Usage API
More information

AddComment

AddComment(sText, sAutor) → { ApiComment }

Adds a comment to the current block content control. Please note that the current block content control 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 oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control.");
oDocument.AddElement(0, oBlockLvlSdt);
oBlockLvlSdt.AddComment("comment", "John Smith");
builder.SaveFile("docx", "AddComment.docx");
builder.CloseFile();

Resulting document