PowerPoint

The Powerpoint class, a core component of the OpenXMLOffice.Presentation library, empowers developers to create, open, and manipulate PowerPoint (.pptx) files with ease. Whether generating new presentations or working with existing ones, this class provides a simple yet powerful interface for efficient content manipulation. Once modifications are complete, users can effortlessly save the updated presentation.

Usage, Options and Examples

Create or open a pptx file from path

public static CreateNew(){
    PowerPoint powerPoint = new(string.Format("../../test-{0}.pptx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")), null);
    powerPoint.Save();
}

public static OpenExisting(){
    PowerPoint powerPoint = new(string.Format("../../test-{0}.pptx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")),true, null);
    powerPoint.SaveAs("/NewPath/file.pptx");
}

Create or open a pptx object using a stream

public static CreateUsingStream(Stream stream){
    PowerPoint powerPoint = new(stream, null);
    powerPoint.Save();
}

Sample using most of the exposed functions

public static CreateNew(){
    PowerPoint powerPoint = new(string.Format("../../test-{0}.pptx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")), null);
    // Add Blank Slide To the Blank Presentation
    // Return Slide Object that can be used to do slide level operation
    Slide slide = powerPoint.AddSlide(PresentationConstants.SlideLayoutType.BLANK);
    powerPoint.AddSlide(PresentationConstants.SlideLayoutType.BLANK);
    Slide slide1 = powerPoint.GetSlideByIndex(1);
    // Move the Slide Order
    powerPoint.MoveSlideByIndex(1,0);
    // Remove Slide and its content from Presentation
    powerPoint.RemoveSlideByIndex(0);
    // Save the Opened Presentation
    powerPoint.Save();
}

PresentationProperties Options

PresentationSettings Options

TODO

  • Multi Slide Master Support

  • Each Slide Master Theme Support

Last updated