Get Started
Usage API
More information

ApiPresentation

new ApiPresentation()

Class representing a presentation.

Methods

Name Description
AddMaster

Adds the slide master to the presentation slide masters collection.

AddSlide

Appends a new slide to the end of the presentation.

ApplyTheme

Applies a theme to all the slides in the presentation.

CreateNewHistoryPoint

Creates a new history point.

GetClassType

Returns a type of the ApiPresentation class.

GetCurrentSlide

Returns the current slide.

GetCurSlideIndex

Returns the index for the current slide.

GetHeight

Returns the presentation height in English measure units.

GetMaster

Returns a slide master by its position in the presentation.

GetMastersCount

Returns a number of slide masters.

GetSlideByIndex

Returns a slide by its position in the presentation.

GetSlidesCount

Returns a number of slides.

GetWidth

Returns the presentation width in English measure units.

RemoveSlides

Removes a range of slides from the presentation. Deletes all the slides from the presentation if no parameters are specified.

ReplaceCurrentImage

Replaces the current image with an image specified.

SetLanguage

Specifies the languages which will be used to check spelling and grammar (if requested).

SetSizes

Sets the size to the current presentation.

SlidesToJSON

Converts the slides from the current ApiPresentation object into the JSON objects.

ToJSON

Converts the ApiPresentation object into the JSON object.

Example

Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
oPresentation.SetSizes(254 * 36000, 190 * 36000);
var oSlide1 = oPresentation.GetCurrentSlide();
oSlide1.RemoveAllObjects();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("flowChartMagneticTape", 200 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is just a sample text.");
oPresentation.CreateNewHistoryPoint();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("New history point was just created.");
oParagraph.AddLineBreak();
var sClassType = oPresentation.GetClassType();
oParagraph.AddText("Class Type = " + sClassType);
var nCurrentSlideIndex = oPresentation.GetCurSlideIndex();
oParagraph.AddLineBreak();
oParagraph.AddText("Current Slide Index = " + nCurrentSlideIndex);
oDocContent.Push(oParagraph);
oSlide1.AddObject(oShape);
var oSlide2 = Api.CreateSlide();
oPresentation.AddSlide(oSlide2);
builder.SaveFile("pptx", "ApiPresentation.pptx");
builder.CloseFile();

Resulting document