跳到主要内容

Select

选择当前文本块。

语法

expression.Select();

expression - 表示 ApiRun 类(文本块)的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

在文档中选中当前 run。

// How to select a text with a cursor in a document.

// Select and display the result in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text.");
paragraph.AddElement(run);
run.Select();
paragraph.AddLineBreak();
paragraph.AddText("The text from the first run was selected.");