AddComment

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

Adds a comment to all contents of the current table. Please note that this table 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 oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is just a sample text in the first cell.");
var oCell = oTable.GetCell(0,0);
oTable.AddElement(oCell, 0, oParagraph);
oTable.AddComment("comment", "John Smith", "uid-1");
builder.SaveFile("docx", "AddComment.docx");
builder.CloseFile();

Resulting document