Skip to main content

SetShd

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

Inherited from ApiTextPr.SetShd.

Syntax​

expression.SetShd(shd);

expression - A variable that represents an ApiRun class.

Parameters​

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

Returns​

ApiTextPr

Example​

Apply a background shading color to a text run in a document.

// How do I shade the background behind a run of text in a document?

// Color the area behind words to make them stand out in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text. ");
paragraph.AddElement(run);
run = Api.CreateRun();
run.SetShd(Api.CreateShd("clear", Api.HexColor('#FF6F3D')));
run.AddText("This is a text run with the text shading set to orange.");
paragraph.AddElement(run);