跳到主要内容

SetText

用指定文本替换段落内容。

语法

expression.SetText(text);

expression - 表示 ApiParagraph 类的变量。

参数

名称必需/可选数据类型默认值描述
text必需string要设置的文本。

返回值

ApiRun

示例

// How do I overwrite the existing text of a paragraph in a document?

// Replace the original text with another text string.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is the original text.");
paragraph.SetText("This is the replacement text.");