跳到主要内容

MoveCursorRight

向右移动光标。

语法

expression.MoveCursorRight(count, addToSelect, byWords);

expression - 表示 ApiDocument 类的变量。

参数

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

返回值

boolean

示例

此示例展示如何在文档中向右移动光标。

// How to move the cursor right by a specified number of characters.

// Add text and move cursor right with selection.
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);