Create and write PowerPoint file in C# and VB.NET

Creating presentation content programmatically with GemBox.Presentation is easy and straightforward. This is done by composing presentation elements through factory methods.

GemBox.Presentation supports writing PowerPoint presentations in C# and VB.NET to a file or a stream. This functionality is exposed through the PresentationDocument.Save method overloads.

The following example shows how to create a new presentation programmatically and how to write a PowerPoint presentation to a file.

Screenshot of PowerPoint file created with GemBox.Presentation
PowerPoint file created with GemBox.Presentation
using GemBox.Presentation;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = new PresentationDocument();

        var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);

        var shape = slide.Content.AddShape(ShapeGeometryType.RoundedRectangle, 2, 2, 8, 4, LengthUnit.Centimeter);
        shape.Format.Fill.SetSolid(Color.FromName(ColorName.DarkBlue));

        var run = shape.Text.AddParagraph().AddRun("This sample shows how to write or save a new PowerPoint file with GemBox.Presentation.");
        run.Format.Fill.SetSolid(Color.FromName(ColorName.White));

        presentation.Save("Writing.%OutputFileType%");
    }
}
Imports GemBox.Presentation

Module Program

    Sub Main()

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

        Dim presentation = New PresentationDocument

        Dim slide = presentation.Slides.AddNew(SlideLayoutType.Custom)

        Dim shape = slide.Content.AddShape(ShapeGeometryType.RoundedRectangle, 2, 2, 8, 4, LengthUnit.Centimeter)
        shape.Format.Fill.SetSolid(Color.FromName(ColorName.DarkBlue))

        Dim run = shape.Text.AddParagraph().AddRun("This sample shows how to write or save a new PowerPoint file with GemBox.Presentation.")
        run.Format.Fill.SetSolid(Color.FromName(ColorName.White))

        presentation.Save("Writing.%OutputFileType%")
    End Sub
End Module

Check next example or download examples from GitHub.