Get Started
Usage API
More information

ApiSlide

new ApiSlide()

Class representing a slide.

Methods

Name Description
AddObject

Adds an object (image, shape or chart) to the current presentation slide.

ApplyLayout

Applies the specified layout to the current slide. The layout must be in slide master.

ApplyTheme

Applies the specified theme to the current slide.

ClearBackground

Clears the slide background.

Copy

Creates a copy of the current slide object.

Delete

Deletes the current slide from the presentation.

Duplicate

Creates a duplicate of the specified slide object, adds the new slide to the slides collection.

FollowLayoutBackground

Sets the layout background as the background of the slide.

FollowMasterBackground

Sets the master background as the background of the slide.

GetAllCharts

Returns an array with all the chart objects from the slide.

GetAllDrawings

Returns an array with all the drawing objects from the slide.

GetAllImages

Returns an array with all the image objects from the slide.

GetAllOleObjects

Returns an array with all the OLE objects from the slide.

GetAllShapes

Returns an array with all the shape objects from the slide.

GetClassType

Returns the type of the ApiSlide class.

GetHeight

Returns the slide height in English measure units.

GetLayout

Returns a layout of the current slide.

GetSlideIndex

Returns a position of the current slide in the presentation.

GetTheme

Returns a theme of the current slide.

GetWidth

Returns the slide width in English measure units.

MoveTo

Moves the current slide to a specific location within the same collection.

RemoveAllObjects

Removes all the objects from the current slide.

RemoveObject

Removes objects (image, shape or chart) from the current slide.

SetBackground

Sets the background to the current presentation slide.

ToJSON

Converts the ApiSlide object into the JSON object.

Example

Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
oPresentation.SetSizes(254 * 36000, 190 * 36000);
var oSlide = oPresentation.GetCurrentSlide();
oSlide.RemoveAllObjects();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("rect", 200 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
var nSlideHeight = oSlide.GetHeight();
oParagraph.AddText("The slide height = " + nSlideHeight / 36000 + " mm");
var nSlideWidth = oSlide.GetWidth();
oParagraph.AddLineBreak();
oParagraph.AddText("The slide width = " + nSlideWidth / 36000 + " mm");
var sClassType = oSlide.GetClassType();
oParagraph.AddLineBreak();
oParagraph.AddText("Class Type = " + sClassType);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "ApiSlide.pptx");
builder.CloseFile();

Resulting document