TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

ApiComment

new ApiComment()

Class representing a comment.

Methods

Name Description
AddReply

Adds a reply to a comment.

Delete

Deletes the current comment from the document.

GetAuthorName

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.

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.

IsSolved

Checks if a comment is solved or not.

RemoveReplies

Removes the specified comment replies.

SetAuthorName

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("pptx");
var oPresentation = Api.GetPresentation();
Api.pluginMethod_AddComment({"UserName": "John Smith", "Text": "Comment 1"});
var arrComments = oPresentation.GetAllComments();
arrComments[0].SetAuthorName("Mark Potato");
arrComments[0].SetUserId("uid-2");
arrComments[0].SetTime(Date.now());
arrComments[0].SetTimeUTC(Date.now());
arrComments[0].SetSolved(true);
arrComments[0].AddReply("Reply 1", "John Smith", "uid-1");
arrComments[0].AddReply("Reply 2", "John Smith", "uid-1");
arrComments[0].RemoveReplies(0, 1, false);
var oReply = arrComments[0].GetReply(0);
var oSlide1 = oPresentation.GetSlideByIndex(0);
oSlide1.RemoveAllObjects();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oShape.SetSize(300 * 36000, 130 * 36000);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.SetJc("left");
oParagraph.AddText("Comment: " + arrComments[0].GetText());
oParagraph.AddLineBreak();
oParagraph.AddText("Comment's quote text: " + arrComments[0].GetQuoteText());
oParagraph.AddLineBreak();
oParagraph.AddText("Type: " + arrComments[0].GetClassType());
oParagraph.AddLineBreak();
oParagraph.AddText("Comment's author: " + arrComments[0].GetAuthorName());
oParagraph.AddLineBreak();
oParagraph.AddText("Timestamp: " + arrComments[0].GetTime());
oParagraph.AddLineBreak();
oParagraph.AddText("Timestamp UTC: " + arrComments[0].GetTimeUTC());
oParagraph.AddLineBreak();
oParagraph.AddText("Comment replies count: " + arrComments[0].GetRepliesCount());
oParagraph.AddLineBreak();
oParagraph.AddText("Comment's reply text: " + oReply.GetText());
oSlide1.AddObject(oShape);
builder.SaveFile("pptx", "ApiComment.pptx");
builder.CloseFile();

Resulting document