GetText

GetText(oPr, [oPr.NewLineSeparator], [oPr.TabSymbol]) → { string }

Returns a text from the text run.

Parameters:

Name Type Default Description
oPr object

The resulting string display properties.

oPr.NewLineSeparator string '\r'

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

oPr.TabSymbol string '\t'

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

Returns:

Type
string

Example

Copy code
builder.CreateFile("docx");
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);
builder.SaveFile("docx", "GetText.docx");
builder.CloseFile();

Resulting document