跳到主要内容

AddReply

Adds a reply to a comment.

Syntax

expression.AddReply(sText, sAuthorName, sUserId, nPos);

expression - A variable that represents a ApiComment class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredStringThe comment reply text (required).
sAuthorNameRequiredStringThe name of the comment reply author (optional).
sUserIdRequiredStringThe user ID of the comment reply author (optional).
nPosOptionalNumber-1The comment reply position. If nPos=-1 add to the end.

Returns

ApiComment

Example

This example adds a comment and makes a reply for it.

// How to reply to the comment.

// Create a comment from a paragraph and add a reply to its first one.

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);