CreateShd
Creates the shading which can be applied to text, a paragraph, a table or a table cell.
Syntax
expression.CreateShd(type, color);
expression - A variable that represents an Api class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| type | Required | ShdType | The shading type: "nil" - no shading, "clear" - solid fill. | |
| color | Optional | ApiColor | The shading color. Required for the "clear" type. |
Returns
Example
Create a shading object and apply it to a paragraph in a document.
// 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);