1. Products
  2.   Presentation
  3.   .NET
  4.   Open XML SDK
 
  

Free .NET Library for Manipulating Presentation Documents

Read, Write, Manipulate and Convert Presentation files via Leading Open Source C# .NET API.

What is Open XML SDK?

Open XML SDK is an open source API, developed by Microsoft and distributed under Microsoft open source code of conduct to manipulate Presentation Documents. The SDK simplifies the process of working with widely-used presentation file formats by providing a rich set of APIs. It empowers software developers to automate tasks, manipulate document content programmatically, and build custom applications tailored to specific business needs.

Using the API, you can add text, header, footer, end notes, footnotes, styles, themes, and more. It allows you to generate high-performance presentation documents and extract data from them. The API support various .NET platforms including, .NET 3.5, .NET 4.0, .NET 4.6, and .NET Standard 1.3. It provides .NET developers with an easy-to-use library that facilitates interacting with this format. You can use the SDK to create new documents, edit existing ones, or extract data from them—all programmatically.

Previous Next

Getting Started with Open XML SDK

You need to have .NET Framework 3.5 or above. Once you have met the prerequisites, you can manually download the repository from GitHub or install from NuGet.

Install Open XML SDK from NuGet

 Install-Package DocumentFormat.OpenXml

Manipulate PPTX file using C#

Open XML SDK allows .NET programmers to create as well as modify presentations from their own .NET applications. In order to modify an existing file, you can open an existing file and append changes like text, paragraphs, tables, and more.

How to Create PPTX via C# API?

using (PresentationDocument doc = PresentationDocument.Create("Presentation.pptx", PresentationDocumentType.Presentation))
{
  // Insert other code here.
}

Create a Table in PPTX using C#

The API allows the developers to add a table in Presentation documents. You can add a table, set table properties, set table grid, and column grid properties. Furthermore, you can manage table cells and rows using TableCell and TableRow classes respectively.

Adding Content to Slides using C# API

Open XML SDK allows software developers to add various types of contents into a presentation inside .NET applications. Software Developers can add more slides with various types of content, including text, images, charts, and more. Here’s an example that shows how software developers can add an image to a slide inside .NET applications.

How to Add an Image to a Slide inside C# Apps?

private void AddImageToSlide(SlidePart slidePart, string imagePath)
{
    ImagePart imagePart = slidePart.AddImagePart(ImagePartType.Png);
    
    // Load the image
    using (FileStream stream = new FileStream(imagePath, FileMode.Open))
    {
        imagePart.FeedData(stream);
    }

    // Define the position of the image on the slide
    var image = new DocumentFormat.OpenXml.Presentation.Picture();
    // Set image properties here (position, size, etc.)

    slidePart.Slide.CommonSlideData.ShapeTree.Append(image);
}

 English