OneDocument is a free, open-source .NET document library from Recursive AI, licensed under MIT or Apache-2.0. NuGet · GitHub
dotnet new console dotnet add package RecursiveAI.OneDocument.Presentations --version 1.0.0
Download 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.
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");
Saved edited.pptxOptional: 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.
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(); }
Changed entries: ppt/slides/slide1.xmlCompare 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 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 Typed PresentationML elements 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 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 Slide and table editing, with PDF and image output. | The cited examples show rendering but don’t specify byte-identical untouched entries. Check the edition limits 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 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 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. 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.