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.

Write PowerPoint Files 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
Writing Screenshot

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

using System;
using System.IO;
using System.Linq;
using System.Text;
using GemBox.Presentation;
using GemBox.Presentation.Tables;

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();

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

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

        TextRun 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.pptx");
    }
}
Imports System.IO
Imports System.Text
Imports GemBox.Presentation
Imports GemBox.Presentation.Tables

Module Samples

    Sub Main()

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

        Dim presentation As PresentationDocument = New PresentationDocument

        Dim slide As Slide = presentation.Slides.AddNew(SlideLayoutType.Custom)
        Dim shape As Shape = slide.Content.AddShape(ShapeGeometryType.RoundedRectangle, 2, 2, 8, 4, LengthUnit.Centimeter)
        shape.Format.Fill.SetSolid(Color.FromName(ColorName.DarkBlue))

        Dim run As TextRun = 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.pptx")

    End Sub

End Module

Check next sample.