跳到主要内容

SetBackground

Sets the background to the current presentation slide.

Syntax

expression.SetBackground(oApiFill);

expression - A variable that represents a ApiSlide class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oApiFillRequiredApiFillThe color or pattern used to fill the presentation slide background.

Returns

boolean

Example

This example sets background color of the slide.

// How to change a background color of the slide.

// Get a slide by its index, set its background and add it to the presentation.

const presentation = Api.GetPresentation();
const slide = Api.CreateSlide();
const gs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 213, 191), 0);
const gs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 111, 61), 100000);
const fill = Api.CreateRadialGradientFill([gs1, gs2]);
slide.SetBackground(fill);
presentation.AddSlide(slide);