Get Started
Usage API
More information

GetText

GetText() → { String }

Returns a text from the specified range.

Parameters:

This method doesn't have any parameters.

Returns:

Type
String

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
var oRange = oDocument.GetRange(0, 24);
var oParagraph2 = Api.CreateParagraph();
oParagraph2.AddText(oRange.GetText());
oDocument.Push(oParagraph2);
builder.SaveFile("docx", "GetText.docx");
builder.CloseFile();

Resulting document