Skip to main content

GetText

Returns the comment text.

Syntax

expression.GetText();

expression - A variable that represents a ApiComment class.

Parameters

This method doesn't have any parameters.

Returns

string

Example

This example shows how to get the comment text.

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();
let text = comments[0].GetText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Comment text: " + text);
doc.Push(paragraph);