跳到主要内容

SetTextFill

设置当前文本运行的文本填充。

语法

expression.SetTextFill(oApiFill);

expression - 表示 ApiTextPr 类的变量。

参数

名称必需/可选数据类型默认值描述
oApiFill必需ApiFill用于填充文本颜色的颜色或图案。

返回值

ApiTextPr

示例

在此示例中,艺术字文本具有文本填充。

// How to color a text object.

// Create a text run object, add color to it using solid fill.

let doc = Api.GetDocument();
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
textPr.SetCaps(true);
textPr.SetOutLine(Api.CreateStroke(0.2 * 36000, Api.CreateSolidFill(Api.RGB(51, 51, 51))));
textPr.SetTextFill(Api.CreateSolidFill(Api.RGB(255, 111, 61)));
textPr.SetFontFamily("Comic Sans MS");
let textArt = Api.CreateWordArt(textPr, "onlyoffice", "textArchUp", null, null, 0, 150 * 36000, 50 * 36000);
let paragraph = doc.GetElement(0);
paragraph.AddDrawing(textArt);