Skip to main content

SetShd

Specifies the shading which is applied to the extents of the current table.

Syntax​

expression.SetShd(shd);

expression - A variable that represents an ApiTablePr class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
shdRequiredApiShdThe shading created with the Api.CreateShd method.

Returns​

boolean

Example​

Fill the background of an entire table with a color in a document.

// How do I apply a background shade to a whole table in a document?

// Give a table a colored backdrop to highlight it visually in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We added an orange shading to the table:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let tablePr = tableStyle.GetTablePr();
let table = Api.CreateTable(3, 3);
tablePr.SetShd(Api.CreateShd("clear", Api.HexColor('#FF6F3D')));
table.SetTableLook(true, true, true, true, false, false);
table.SetStyle(tableStyle);
doc.Push(table);