Returns a text from the specified range.
Name | Type | Default | Description |
oPr | object | The resulting string display properties. |
|
oPr.NewLineParagraph | boolean | false | Defines if the resulting string will include paragraph line boundaries or not. |
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.TableCellSeparator | string | '\t' | Defines how the table cell separator will be specified in the resulting string. |
oPr.TableRowSeparator | string | '\r\n' | Defines how the table row separator will be specified in the resulting string. |
oPr.ParaSeparator | string | '\r\n' | Defines how the paragraph 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) |
builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oParagraph = oDocument.GetElement(0); oParagraph.AddText("\tONLYOFFICE Document Builder"); var oRange = oDocument.GetRange(0, 24); var sText = oRange.GetText({"Numbering": true, "Math": true, "NewLineSeparator": "\r", "TabSymbol": "\t", "NewLineParagraph": true, "TableCellSeparator": "\t", "TableRowSeparator": "\r\n", "ParaSeparator": "\r\n"}); oParagraph = Api.CreateParagraph(); oParagraph.AddText("The text of the specified range: " + sText); oDocument.Push(oParagraph); builder.SaveFile("docx", "GetText.docx"); builder.CloseFile();