Skip to main content

GetSlideByIndex

Returns a slide by its position in the presentation.

note

This functionality is available in paid ONLYOFFICE Docs editions.

Syntax

expression.GetSlideByIndex(nIndex);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nIndexRequirednumberThe slide index (position) in the presentation.

Returns

ApiSlide

Example

Get a slide by its position using the Api global object in a presentation.

// Find a slide from the presentation using its index via the Api object.

// Get a slide by its index directly from the Api object.

const slide = Api.GetSlideByIndex(0);
slide.RemoveAllObjects();

const fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
slide.AddObject(shape);