跳到主要内容

CreateShd

创建可应用于文本、段落、表格或表格单元格的底纹。

语法​

expression.CreateShd(type, color);

expression - 表示 Api 类的变量。

参数​

名称必需/可选数据类型默认值描述
type必需ShdType底纹类型:“nil” - 无底纹,“clear” - 纯色填充。
color可选ApiColor底纹颜色。对于 "clear" 类型为必需项。

返回值​

ApiShd

示例​

创建底纹对象并将其应用于文档中的段落。

// Build the shading once with Api.CreateShd and pass it to the SetShd method in a document.

// Shade a paragraph with a light yellow background in a document.

const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
paragraph.AddText('This paragraph has a light yellow shading.');
const shd = Api.CreateShd('clear', Api.Color('#FFF2CC'));
paragraph.SetShd(shd);