GetId

GetId() → { string }

Returns the current comment ID. If the comment doesn't have an ID, null is returned.

Parameters:

This method doesn't have any parameters.

Returns:

Type
string

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is just a sample text");
Api.AddComment(oParagraph, "comment", "John Smith");
var aComments = oDocument.GetAllComments();
var sId = aComments[0].GetId();
var oComment = oDocument.GetCommentById(sId);
var sAuthor = oComment.GetAuthorName();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Comment author name: " + sAuthor);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetId.docx");
builder.CloseFile();

Resulting document