MoveCursorRight
向右移动光标。
语法
expression.MoveCursorRight(count, addToSelect, byWords);
expression - 表示 ApiPresentation 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| count | 可选 | number | 1 | 移动次数。 |
| addToSelect | 可选 | boolean | false | 指定在移动过程中是否选择文本。 |
| byWords | 可选 | boolean | false | 指定是按单词移动还是按字符移动。 |
返回值
boolean
示例
在形状文本范围内将文本光标向右移动一个位置。
// Cursor movement methods allow precise text navigation in interactive or plugin mode.
// Position the cursor mid-word, move it right, then insert text at the new location.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const shape = Api.CreateShape("rect", 3000000, 1000000);
slide.RemoveAllObjects();
slide.AddObject(shape);
shape.GetTextRange().SetText("Hello World");
shape.GetTextRange().MoveCursorToPos(5);
presentation.MoveCursorRight(1, false, false);
presentation.EnterText("Beautiful ");