跳到主要内容

SetShd

指定应用于当前文本块内容的底纹。

继承自 ApiTextPr.SetShd。

语法​

expression.SetShd(shd);

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

参数​

名称必需/可选数据类型默认值描述
shd必需ApiShd使用 Api.CreateShd 方法创建的底纹。

返回值​

ApiTextPr

示例​

在文档中为文本运行应用背景底纹颜色。

// How do I shade the background behind a run of text in a document?

// Color the area behind words to make them stand out 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 = Api.CreateRun();
run.SetShd(Api.CreateShd("clear", Api.HexColor('#FF6F3D')));
run.AddText("This is a text run with the text shading set to orange.");
paragraph.AddElement(run);