Get Started
Documentation

SetShd

SetShd(sType, r, g, b, [isAuto])

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

Parameters:

Name Type Default Description
sType ShdType

The shading type applied to the extents of the current table.

r byte

Red color component value.

g byte

Green color component value.

b byte

Blue color component value.

isAuto boolean false

The true value will disable the SetShd method use.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oTablePr;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We added a gray shading to the table:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTablePr = oTableStyle.GetTablePr();
oTable = Api.CreateTable(3, 3);
oTablePr.SetShd("clear", 0xEE, 0xEE, 0xEE, false);
oTable.SetTableLook(true, true, true, true, false, false);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetShd.docx");
builder.CloseFile();

Resulting document