Get Started
Usage API

GetRange

GetRange(Start, End) → { ApiRange }

Returns a Range object that represents the part of the document contained in the document content.

Parameters:

Name Type Description
Start Number

start character in current element

End Number

end character in current element

Returns:

Type
ApiRange

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("rect", 3212465, 963295, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
oDocContent = oDrawing.GetDocContent();
oDocContent.RemoveAllElements();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is just a sample paragraph.");
oDocContent.AddElement(oParagraph);
oDocContent.Push(oParagraph);
oRange = oDocContent.GetRange(8, 11);
oRange.SetBold(true);
builder.SaveFile("docx", "GetRange.docx");
builder.CloseFile();

Resulting document