Skip to main content

SetBackground

Sets the background to the current slide layout.

Syntax

expression.SetBackground(oApiFill);

expression - A variable that represents a ApiLayout class.

Parameters

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

Returns

boolean

Example

This example sets the background to the current slide layout.

// How to set a background of a layout.

// Create a gradient fill and apply it as a background.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const master = presentation.GetMaster(0);
const layout = master.GetLayout(0);

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]);
layout.SetBackground(fill);
slide.FollowLayoutBackground();