Get Started
Documentation

SetShd

SetShd(sType, r, g, b)

Specify the shading applied to the contents of the current text run.

Parameters:

Name Type Description
sType ShdType The shading type applied to the contents of the current text run.
r byte Red color component value.
g byte Green color component value.
b byte Blue color component value.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTextPr;
oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetShd("clear", 0, 255, 0);
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("A sample text with the shading set to green.");
builder.SaveFile("docx", "SetShd.docx");
builder.CloseFile();

Resulting document