跳到主要内容

MoveCursorRight

向右移动光标。

语法

expression.MoveCursorRight(count, addToSelect, byWords);

expression - 表示 ApiDocument 类的变量。

参数

名称必需/可选数据类型默认值描述
count可选number1移动次数。
addToSelect可选booleanfalse指定在移动过程中是否选择文本。
byWords可选booleanfalse指定是按单词移动还是按字符移动。

返回值

boolean

示例

在文档中将光标向右移动指定的字符数。

// How do I advance the cursor forward through text in a document?

// Skip past a known number of characters to land on a specific word for reading in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is the text in your document.");
doc.MoveCursorRight(12);

paragraph = Api.CreateParagraph();
paragraph.AddText(doc.GetCurrentWord());
doc.Push(paragraph);