跳到主要内容

MoveCursorLeft

向左移动光标。

语法

expression.MoveCursorLeft(count, addToSelect, byWords);

expression - 表示 ApiDocument 类的变量。

参数

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

返回值

boolean

示例

在文档中将光标向左移动。

// How to move the cursor left by a specified number of characters in a document.

// Add text, move cursor right, then move it left in a document.

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

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