Skip to main content

GetCurrentVisibleSlide

Returns the current visible slide.

Syntax

expression.GetCurrentVisibleSlide();

expression - A variable that represents a ApiPresentation class.

Parameters

This method doesn't have any parameters.

Returns

ApiSlide | null

Example

This example shows how to get an object for a Slide that is currently visible.

const presentation = Api.GetPresentation();
const slide = presentation.GetCurrentVisibleSlide();

if (slide) {
const labelFill = Api.CreateSolidFill(Api.CreateRGBColor(150, 200, 150));
const labelStroke = Api.CreateStroke(0, Api.CreateNoFill());
const label = Api.CreateShape('rect', 60 * 36000, 20 * 36000, labelFill, labelStroke);
label.SetPosition(0, 50 * 36000);
slide.AddObject(label);

const docContent = label.GetDocContent();
const paragraph = docContent.GetElement(0);
paragraph.AddText('This slide is currently visible');
}