ApiComment
Class representing a comment.
Methods
Name |
Description |
AddReply |
Adds a reply to a comment. |
Delete |
Deletes the current comment from the document. |
GetAutorName |
Returns the comment author's name. |
GetClassType |
Returns a type of the ApiComment class. |
GetQuoteText |
Returns the quote text of the current comment. |
GetRepliesCount |
Returns a number of the comment replies. |
GetReply |
Returns the specified comment reply. |
GetText |
Returns the comment text. |
GetTime |
Returns the timestamp of the comment creation in the current time zone format. |
GetTimeUTC |
Returns the timestamp of the comment creation in UTC format. |
GetUserId |
Returns the user ID of the comment author. |
IsSolved |
Checks if a comment is solved or not. |
RemoveReplies |
Removes the specified comment replies. |
SetAutorName |
Sets the comment author's name. |
SetSolved |
Marks a comment as solved. |
SetText |
Sets the comment text. |
SetTime |
Sets the timestamp of the comment creation in the current time zone format. |
SetTimeUTC |
Sets the timestamp of the comment creation in UTC format. |
SetUserId |
Sets the user ID to the comment author. |
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();
aComments[0].SetTimeUTC("1672247153658");
aComments[0].SetUserId("uid-1");
aComments[0].AddReply("reply1", "Mark Potato", "uid-2", 0);
var sType = aComments[0].GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type: " + sType);
oDocument.Push(oParagraph);
var sTimeUTC = aComments[0].GetTimeUTC();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The timestamp of comment creation: " + sTimeUTC);
oDocument.Push(oParagraph);
var sAutor = aComments[0].GetAutorName();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Comment author name: " + sAutor);
oDocument.Push(oParagraph);
var sQuoteText = aComments[0].GetQuoteText();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Comment quote text: " + sQuoteText);
oDocument.Push(oParagraph);
var sText = aComments[0].GetText();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Comment text: " + sText);
oDocument.Push(oParagraph);
var sUserId = aComments[0].GetUserId();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Comment user ID: " + sUserId);
oDocument.Push(oParagraph);
aComments[0].SetSolved(true);
var bSolved = aComments[0].IsSolved();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The comment is solved: " + bSolved);
oDocument.Push(oParagraph);
var nReplies = aComments[0].GetRepliesCount();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Number of comment replies: " + nReplies);
oDocument.Push(oParagraph);
var oCommentReply = aComments[0].GetReply(0);
oParagraph = Api.CreateParagraph();
oParagraph.AddText("First comment reply: " + oCommentReply.GetText());
oDocument.Push(oParagraph);
builder.SaveFile("docx", "ApiComment.docx");
builder.CloseFile();
Resulting document