---
title: "C# PPTX libraries for headless editing"
url: https://recursiveai.org/onedocument/articles/csharp-powerpoint-library/
description: "Headless editing means changing .pptx files without PowerPoint installed. Compare what OneDocument, the Open XML SDK, and other libraries can preserve."
date: 2026-11-30
author: OneDocument team
---

# C# PPTX libraries for headless editing

Headless editing means changing .pptx files without PowerPoint installed. Compare what OneDocument, the Open XML SDK, and other libraries can preserve.

November 30, 2026 · OneDocument team

[OneDocument](https://recursiveai.org/onedocument/) is a free, open-source .NET document library from Recursive AI, licensed under [MIT or Apache-2.0](https://licenses.nuget.org/MIT%20OR%20Apache-2.0). [NuGet](https://www.nuget.org/packages/RecursiveAI.OneDocument.Presentations/1.0.0) · [GitHub](https://github.com/recursive-ai-oss/onedocument-csharp)

*Install · .NET 10*

```
dotnet new console
dotnet add package RecursiveAI.OneDocument.Presentations --version 1.0.0
```

Download [`slide-runs.pptx`](https://raw.githubusercontent.com/recursive-ai-oss/onedocument-csharp/a85720e075c783fc596641d8586ee126cae088c5/testdata/slides/slide-runs.pptx) as `template.pptx` in the project folder. Replace `Program.cs` and run `dotnet run`. The program edits the first text shape and saves a copy.

No template yet? Start with the [create a PowerPoint presentation recipe](https://recursiveai.org/onedocument/cookbook/create-powerpoint-presentation/).

*Program.cs · .NET 10*

```
using RecursiveAI.OneDocument.Presentations;
using var deck = Presentation.Open("template.pptx");
var shape = deck.Slides[0].Shapes.First(s => s.TextBody is not null);
shape.TextBody!.SetText("Quarterly update");
deck.SaveAs("edited.pptx");
Console.WriteLine("Saved edited.pptx");
```

*Output*

```
Saved edited.pptx
```

## Optional: Check which PPTX parts changed

Leave both files in the project folder, replace `Program.cs` with this check, and run `dotnet run` again. It compares decompressed ZIP entry bytes and reports entries that changed, were added, or were removed.

*Program.cs · .NET 10*

```
using System.IO.Compression;
 
using var before = ZipFile.OpenRead("template.pptx");
using var after = ZipFile.OpenRead("edited.pptx");
var changed = before.Entries
    .Where(entry => after.GetEntry(entry.FullName) is not { } saved ||
        !Read(entry).SequenceEqual(Read(saved)))
    .Select(entry => entry.FullName)
    .Concat(after.Entries.Where(entry => before.GetEntry(entry.FullName) is null)
        .Select(entry => entry.FullName));
Console.WriteLine($"Changed entries: {string.Join(", ", changed)}");
 
static byte[] Read(ZipArchiveEntry entry)
{
    using var source = entry.Open();
    using var bytes = new MemoryStream();
    source.CopyTo(bytes);
    return bytes.ToArray();
}
```

*Output*

```
Changed entries: ppt/slides/slide1.xml
```

## Compare headless PPTX libraries

Choose a C# PPTX library by what you need to change and what must stay untouched. OneDocument edits slides, text, tables, and speaker notes without PowerPoint. For direct control of PresentationML, the XML that describes a PowerPoint deck, use the Open XML SDK. If the main output is a PDF, compare rendering support separately.

The table describes the cited APIs and docs as checked November 30, 2026. The byte comparison above tests OneDocument on one specific edit, not all libraries.

| Library and what you edit | Preservation and limits |
|---|---|
| [OneDocument 1.0.0](https://github.com/recursive-ai-oss/onedocument-csharp/blob/a85720e075c783fc596641d8586ee126cae088c5/docs/presentations.md)
Presentation, slide, shape, run, table cell, and notes APIs. Add, duplicate, move, or delete slides. | Copies untouched ZIP entries as stored. Chart, SmartArt, and OLE payloads stay as stored; a graphic frame exposes references, not a payload editor. PDF and PNG rendering are in a separate package. |
| [Open XML SDK 3.5.1](https://www.nuget.org/packages/DocumentFormat.OpenXml/3.5.1)
[Typed PresentationML elements](https://learn.microsoft.com/en-us/office/open-xml/presentation/overview) and package parts for direct markup edits. | Useful when you need explicit control of parts and relationships. The cited overview doesn’t specify a byte-for-byte save guarantee or a slide renderer. |
| [ShapeCrawler 0.82.0](https://www.nuget.org/packages/ShapeCrawler/0.82.0)
Slide, shape, and text editing through a higher-level API built on the Open XML SDK. | The package docs show shape and text edits. They don’t state a byte-for-byte preservation guarantee for untouched entries. |
| [GemBox.Presentation 2026.11.122](https://www.nuget.org/packages/GemBox.Presentation/2026.11.122)
[Slide and table editing, with PDF and image output](https://www.gemboxsoftware.com/presentation/examples/c-sharp-vb-net-powerpoint/601). | The cited examples show rendering but don’t specify byte-identical untouched entries. Check the [edition limits](https://www.gemboxsoftware.com/presentation/pricelist) for your workload. |

## Untouched parts are not the same as an untouched file

A PPTX is a ZIP of related parts. Changing one text box should not require rewriting its layout, theme, or every other slide. [OneDocument’s round-trip contract](https://github.com/recursive-ai-oss/onedocument-csharp/blob/a85720e075c783fc596641d8586ee126cae088c5/docs/presentations.md#L19-L23) copies unedited parts as stored and keeps unedited elements and attributes in an edited part. The sample verifies the entry contents, not the bytes of the ZIP as a whole or PowerPoint’s visual rendering.

Operations that change structure naturally touch more than one part. For example, [duplicating a slide](https://github.com/recursive-ai-oss/onedocument-csharp/blob/a85720e075c783fc596641d8586ee126cae088c5/docs/presentations.md#L38-L46) can copy its chart and embedded workbook, while sharing its theme and images. Slide operations don’t update the slide count and titles in `docProps/app.xml`. For template edits, target the run if you need to keep mixed formatting within a text box; replacing its full text with `TextBody.SetText` is not a run-preserving edit.

## Choose the API for the job

- **Fill a branded deck:** use slide and shape APIs, then check the unchanged parts on a copy of your real template.
- **Change a specific XML element or relationship:** use the Open XML SDK and check the parts you intend to modify.
- **Deliver PDF or images:** test the renderer against your own slides, fonts, and charts. In OneDocument, start with the [presentation rendering docs](https://recursiveai.org/onedocument/docs/presentation-rendering/). A successful PPTX save is not a rendering test.

For the difference between package editing and rendering, see [Open XML SDK vs. document conversion libraries](https://recursiveai.org/onedocument/articles/open-xml-sdk-vs-document-conversion-libraries/).
