跳到主要内容

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

This example appends a new slide to the end of the presentation.

// How to add a new slide to the presentation.

// Create a slide and add it to the end of 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);