SetBackground
Sets the background to the current slide layout.
Syntax
expression.SetBackground(oApiFill);
expression
- A variable that represents a ApiLayout class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
oApiFill | Required | ApiFill | The color or pattern used to fill the presentation slide layout background.\ |
Returns
boolean
Example
This example sets the background to the current slide layout.
- Code
- Result
// 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();