跳到主要内容

RemoveReplies

Removes the specified comment replies.

Syntax

expression.RemoveReplies(nPos, nCount, bRemoveAll);

expression - A variable that represents a ApiComment class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPosOptionalNumber0The position of the first comment reply to remove.
nCountOptionalNumber1A number of comment replies to remove.
bRemoveAllOptionalbooleanfalseSpecifies whether to remove all comment replies or not.

Returns

ApiComment

Example

This example removes the specified comment replies.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text");
Api.AddComment(paragraph, "comment", "John Smith");
let comments = doc.GetAllComments();
comments[0].AddReply("reply1", "Mark Potato", "uid-2", 0);
comments[0].RemoveReplies();
paragraph = Api.CreateParagraph();
paragraph.AddText("The comment replies were removed");
doc.Push(paragraph);