Get Started
Documentation

SetShd

SetShd(sType, r, g, b, isAutoopt)

Inherited From:

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

Parameters:

Name Type Attributes 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 <optional> false The true value will disable the SetShd method use.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle;
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"));
oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.SetShd("clear", 0xEE, 0xEE, 0xEE, false);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetShd.docx");
builder.CloseFile();

Resulting document