Skip to main content

AddComment

Adds a comment to the current inline content control. 💡 Please note that this inline content control must be in the document.

Syntax

expression.AddComment(sText, sAuthor, sUserId);

expression - A variable that represents a ApiInlineLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringThe comment text.
sAuthorOptionalstringThe author's name.
sUserIdOptionalstringThe user ID of the comment author.

Returns

ApiComment

Example

Add a comment to an inline content control in a document.

// How do I attach a comment to an inline text control in a document?

// Annotate an inline control with a reviewer name and note in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let inlineLvlSdt = Api.CreateInlineLvlSdt();
inlineLvlSdt.AddText("This is an inline text content control.");
paragraph.AddInlineLvlSdt(inlineLvlSdt);
inlineLvlSdt.AddComment("comment", "John Smith");