Get Started
Documentation

GetText

GetText() → { String }

Get text in the specified range

Returns:

Type
String

Example

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

Resulting document