Skip to main content

GetText

Returns the inner text of the current document content object.

Syntax

expression.GetText(oProps);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oPropsRequiredobjectThe resulting string display properties.
oProps.NumberingRequiredbooleanDefines if the resulting string will include numbering or not.
oProps.MathRequiredbooleanDefines if the resulting string will include mathematical expressions or not.
oProps.TableCellSeparatorOptionalstring'\t'Defines how the table cell separator will be specified in the resulting string. Any symbol can be used. The default separator is "\t".
oProps.TableRowSeparatorOptionalstring'\r\n'Defines how the table row separator will be specified in the resulting string. Any symbol can be used. The default separator is "\r\n".
oProps.ParaSeparatorOptionalstring'\r\n'Defines how the paragraph separator will be specified in the resulting string. Any symbol can be used. The default separator is "\r\n".
oProps.TabSymbolOptionalstring'\t'Defines how the tab will be specified in the resulting string. Any symbol can be used. The default symbol is "\t".
oProps.NewLineSeparatorOptionalstring'\r'Defines how the line separator will be specified in the resulting string. Any symbol can be used. The default separator is "\r".

Returns

string

Example

This example gets a text from document content element.

let oDocument = Api.GetDocument();
let oBlockLvlSdt = Api.CreateBlockLvlSdt();
oDocument.Push(oBlockLvlSdt);
let oContent = oBlockLvlSdt.GetContent();
oContent.GetElement(0).AddText("This is a block text content control.");
let oPara = Api.CreateParagraph();
oPara.AddText("This text from DocContent element: " + oContent.GetText());
oDocument.Push(oPara);