Click or drag to resize

Hello World Example

Before using GemBox.Presentation, you need to install the component using one of the following methods:

Step–by–step guide to using GemBox.Presentation

  1. Create a new .NET project (or use an existing one).

  2. If you installed Setup, then add a reference to the GemBox.Presentation component by using Add Reference dialog (it'll be under Assemblies -> Extensions); otherwise you can skip this step (NuGet automatically adds a reference).

  3. Add a directive for GemBox.Presentation namespace; for a C# project use "using GemBox.Presentation;", for a VB.NET project use "Import GemBox.Presentation".

  4. Set the license key to use GemBox.Presentation in Free mode; for a C# project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY");", for a VB.NET project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY")".

Now you can write your application–specific presentation processing code like the one below.

Example

Using the GemBox.Presentation component is easy and straightforward. The following code shows how to create a slide with the "Hello World!" text:

// Create a new empty presentation.
var presentation = new PresentationDocument();

// Add a new empty slide.
var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);

// Add a text box of size 5 x 5 cm in the top-left corner of the slide.
var textBox = slide.Content.AddTextBox(0, 0, 5, 5, LengthUnit.Centimeter);

// Add a paragraph with text content to the text box.
textBox.AddParagraph().AddRun("Hello World!");

// Save the presentation to PPTX and PDF file.
presentation.Save("Presentation.pptx");
presentation.Save("Presentation.pdf");