GetRange
Returns a Range object that represents the document part contained in the specified range.
Parameters:
Name |
Type |
Default |
Description |
Start |
Number
|
0 |
Start character index in the current range. |
End |
Number
|
-1 |
End character index in the current range (if <= 0, then the range is taken to the end). |
Returns:
- Type
-
ApiRange
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
var oRange1 = oDocument.GetRange(0, 24);
oRange1.SetBold(true);
var oRange2 = oRange1.GetRange(0, 9);
oRange2.SetItalic(true);
builder.SaveFile("docx", "GetRange.docx");
builder.CloseFile();
Resulting document