跳到主要内容

AddText

向当前文本块添加文本。

语法

expression.AddText(text);

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

参数

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

返回值

boolean

示例

在文档中向 run 添加文本。

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

// 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);