跳到主要内容

SetShd

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

Syntax

expression.SetShd(type, color);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
typeRequiredShdTypeThe shading type applied to the contents of the current text Range.
colorRequiredApiColorNo description provided.

Returns

ApiRange | null

Example

This example specifies the shading applied to the contents of the current text Range.

// How to set a shading for a range text.

// Get a range text, specify its shading options.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 24);
range.SetShd("clear", Api.HexColor('#FF6F3D'));