GetText

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

Returns the paragraph text.

Parameters:

Name Type Default Description
oPr object

The resulting string display properties.

oPr.Numbering boolean false

Defines if the resulting string will include numbering or not.

oPr.Math boolean false

Defines if the resulting string will include mathematical expressions or not.

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 (does not apply to numbering).

Returns:

Type
string

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("\tThis is just a sample text.");
var sText = oParagraph.GetText({"Numbering": true, "Math": true, "NewLineSeparator": "\r", "TabSymbol": "\t"});
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The text of the first paragraph: " + sText);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetText.docx");
builder.CloseFile();

Resulting document