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
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
nPos | Optional | number | 0 | The desired cursor position. |
Returns
boolean
Example
This example moves cursor to a specified position inside the range object.
- Code
- Result
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);