Skip to main content

AddSlide

Appends a new slide to the end of the presentation.

Syntax

expression.AddSlide(oSlide, nIndex);

expression - A variable that represents a ApiPresentation class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oSlideRequiredApiSlideThe slide created using the Api#CreateSlide method.
nIndexRequirednumberIndex of the slide to be added. If not specified, the slide will be added to the end of the presentation.

Returns

This method doesn't return any data.

Example

Append a new slide to the end of the presentation.

// The new slide is created with a radial gradient background.

// Create a slide and add it to the end of presentation.

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