跳到主要内容

AddText

向当前文本块添加文本。

语法

expression.AddText(text);

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

参数

名称必需/可选数据类型默认值描述
text必需string要添加到当前文本块的文本。

返回值

boolean

示例

此示例向文本块添加文本。

// How to add a sentence to the text run.

// Add text to the document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text. Nothing special.");
paragraph.AddElement(run);