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

With GemBox.Presentation you can create and write PowerPoint files in an easy and straightforward manner. This is done by composing presentation elements through factory methods.

You can save the presentation using one of the PresentationDocument.Savemethods from your C# and VB.NET application. These methods enable you to work with a physical file (when providing the file's path) or with an in-memory file (when providing the file's Stream).

The following example shows how you can create a new PowerPoint file and write some shape and text to the presentation.

Creating and writing PowerPoint presentation's shape and text in C# and VB.NET
Screenshot of written shape and text in output PowerPoint presentation
using GemBox.Presentation;

class Program
{
    static void Main()
    {
        // If using the 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 the 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

See also


Next steps

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.

Download Buy