跳到主要内容

SetShd

指定应用于段落内容的底纹。

继承自 ApiParaPr.SetShd。

语法​

expression.SetShd(type, color);

expression - 表示 ApiParagraph 类的变量。

参数​

名称必需/可选数据类型默认值描述
type必需ShdType将应用于当前段落内容的底纹类型。
color必需ApiColor用于填充底纹的颜色或图案。

返回值​

boolean

示例​

在文档中为段落应用背景底纹颜色。

// How do I fill the background of a paragraph with a specific color in a document?

// Highlight paragraph content by setting its background shade in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is an example of setting a shade to a paragraph. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.SetShd("clear", Api.HexColor('#FF6F3D'));