Skip to main content

MoveCursorToPos

Moves a cursor to a specified position of the current range object. If there is any selection in the document, it will be removed.

Syntax

expression.MoveCursorToPos(nPos);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPosOptionalnumber0The desired cursor position.

Returns

boolean

Example

This example moves cursor to a specified position inside the range object.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This text for time field");
let range = paragraph.GetRange();
range.MoveCursorToPos(range.GetEndPos());
paragraph = Api.CreateParagraph();
paragraph.AddText("The cursor was moved to the end of range");
doc.Push(paragraph);