GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Use PowerPoint slides in C# and VB.NET

To enable a more consistent look and feel for presentation slides, the slides are organized in a hierarchy: master slides, layout slides and slides. Each slide in the hierarchy can define formatting or placeholders that are inherited by the descendant slides.

For more information about master slides, layout slides and slides, see the GemBox.Presentation content model help page.

The following C# and VB.NET example shows how to create and customize master slides, layout slides and slides using the GemBox.Presentation API.

Screenshot
PowerPoint Library for C# / VB.NET Screenshot

See the full code below, use Run Example to execute.

using System;
using System.IO;
using System.Linq;
using GemBox.Presentation;
using GemBox.Presentation.Media;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        PresentationDocument presentation = new PresentationDocument();

        // Get slide size.
        SlideSize size = presentation.SlideSize;

        // Set slide size.
        size.SizedFor = SlideSizeType.OnscreenShow16X10;
        size.Orientation = Orientation.Landscape;
        size.NumberSlidesFrom = 1;

        // Create new master slide.
        MasterSlide master = presentation.MasterSlides.AddNew();

        // Create new layout slide for existing master slide.
        LayoutSlide layout = master.LayoutSlides.AddNew(SlideLayoutType.TitleAndObject);

        // Create new slide from existing template layout slide.
        Slide slide = presentation.Slides.AddNew(layout);

        // If master slide collection is empty, this method will add a new master slide.
        // If layout slide collection of the last master slide doesn't contain a layout slide with the specified type, 
        // then a new layout slide with the specified type will be added.
        slide = presentation.Slides.AddNew(SlideLayoutType.TwoTextAndTwoObjects);

        presentation.Save("Slides.pptx");
    }
}
Imports System.IO
Imports GemBox.Presentation
Imports GemBox.Presentation.Media

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim presentation As PresentationDocument = New PresentationDocument

        ' Get slide size.
        Dim size As SlideSize = presentation.SlideSize

        ' Set slide size.
        size.SizedFor = SlideSizeType.OnscreenShow16X10
        size.Orientation = Orientation.Landscape
        size.NumberSlidesFrom = 1

        ' Create New master slide.
        Dim master As MasterSlide = presentation.MasterSlides.AddNew()

        ' Create New layout slide for existing master slide.
        Dim layout As LayoutSlide = master.LayoutSlides.AddNew(SlideLayoutType.TitleAndObject)

        ' Create New slide from existing template layout slide.
        Dim slide As Slide = presentation.Slides.AddNew(layout)

        ' If master slide collection is empty, this method will add a new master slide.
        ' If layout slide collection of the last master slide doesn't contain a layout slide with the specified type, 
        ' then a new layout slide with the specified type will be added.
        slide = presentation.Slides.AddNew(SlideLayoutType.TwoTextAndTwoObjects)

        presentation.Save("Slides.pptx")

    End Sub

End Module

Check next sample.