GetText

function GetText(
  oPr: object = null,
  oPr.NewLineSeparator: string = '\r',
  oPr.TabSymbol: string = '\t',
): string

Description

Returns a text from the text run.

Parameters

oProbjectdefault: null

The resulting string display properties.

oPr.NewLineSeparatorstringdefault: '\r'

Defines how the line separator will be specified in the resulting string.

oPr.TabSymbolstringdefault: '\t'

Defines how the tab will be specified in the resulting string.

Returns

string

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun = Api.CreateRun();
oRun.AddText("\tThis is a text run");
oParagraph.AddElement(oRun);
var sText = oRun.GetText({"NewLineSeparator": "\r", "TabSymbol": "\t"});
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The text of the specified run: " + sText);
oDocument.Push(oParagraph);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).