| name | devexpress-office-file-api-presentation |
| description | Build .NET applications with the DevExpress Presentation API for creating, reading, modifying, and exporting PowerPoint presentations programmatically without Microsoft Office. Use when working with .pptx files, slides, shapes, text, tables, slide masters and layouts, themes, slide backgrounds, notes, headers/footers, or exporting presentations to PDF. Also use when someone mentions "DevExpress Presentation", "Presentation API", "DevExpress.Docs.Presentation", "create PowerPoint in C#", "pptx automation .NET", "merge presentations", or asks about any PowerPoint/presentation processing with DevExpress. Covers .NET. |
| metadata | {"author":"DevExpress","version":26.1,"source-commit":"d4a70c0b5f39f3c991dd5ee8fa51f2d413ef26b6"} |
DevExpress Presentation API
The Presentation API is a cross-platform .NET library for creating, loading, modifying, saving, and printing PowerPoint presentations in code — without requiring Microsoft Office. It supports PPTX, PPTM, POTX, and POTM formats and can export to PDF. You can use it in console, desktop, and web applications targeting .NET 6+.
When to Use This Skill
Use this skill when you need to:
- Create PowerPoint presentations (.pptx) programmatically without Microsoft Office
- Load and read existing .pptx/.pptm/.potx/.potm files
- Modify existing presentations (add/remove slides, update shapes and text)
- Manage slides: add, remove, reorder, clone, or copy slides between presentations
- Work with shapes: add geometric shapes, picture shapes, and configure fill and outline
- Add and format text inside shapes (paragraphs, runs, bullets, font settings)
- Create and customize tables on slides (rows, columns, cells, styles, borders)
- Set slide backgrounds (solid color, gradient, pattern, picture)
- Configure slide masters and layouts for consistent presentation design
- Export presentations to PDF with options (security, image quality, signatures)
- Merge or split presentations
- Add, read, or remove speaker notes
- Configure headers and footers on slides
- Search, replace, or remove text across a presentation
- Extract text and images from presentation slides
- Print presentations
- Configure themes, view settings, and document properties
Prerequisites & Installation
NuGet Packages
| Package | Purpose |
|---|
DevExpress.Docs.Presentation | Core presentation processing (create, load, edit, save, export) |
.NET (6/7/8+)
dotnet add package DevExpress.Docs.Presentation
Important: All DevExpress packages in a project must share the same version number. A valid DevExpress license is required.
Before You Start — Ask the Developer
Before generating code, ask these questions to avoid rework:
General Questions
- Target framework: Are you using .NET 8+, .NET 6/7, or .NET Framework 4.x?
- New or existing project?: Are you creating a new project or adding to an existing one?
- Hosting model: Console app, ASP.NET Core, Blazor, MAUI, WinForms, WPF, or something else?
Presentation-Specific Questions
- Operation type: Create new presentation / read existing / modify slides / merge-split / export to PDF?
- Features needed: Slides / shapes / text / tables / backgrounds / themes / notes / headers-footers?
- Output: Do you need to extract content or produce a .pptx / PDF?
Rule: If the developer's answer is ambiguous or missing, ask before generating code. Do not guess.
Component Overview
The Presentation API provides:
- Document management: Create, load, and save presentations (
Presentation, DocumentFormat)
- Slide management: Add, remove, reorder, clone, and copy slides (
Slide, SlideCollection)
- Masters and layouts: Define consistent slide designs (
SlideMaster, SlideLayout, SlideLayoutType)
- Shapes and text: All shape types, text areas, paragraphs, runs, and formatting (
Shape, TextArea, TextParagraph, TextRun)
- Tables: Create and customize slide tables (
Table, TableCell, TableRow, TableColumn)
- Export and print: PDF export with options, printing (
ExportToPdf, PdfExportOptions, PrintOptions)
Core Entry Point
using DevExpress.Docs.Presentation;
Presentation presentation = new Presentation();
using FileStream fs = File.OpenRead("input.pptx");
Presentation loaded = new Presentation(fs);
Presentation fromBytes = new Presentation(File.ReadAllBytes("input.pptx"));
using FileStream output = new FileStream("output.pptx", FileMode.Create);
presentation.SaveDocument(output);
presentation.ExportToPdf("output.pdf");
Documentation & Navigation Guide
Getting Started
Refer to references/getting-started.md
When you need to:
- Set up the Presentation API for the first time
- Understand NuGet packages and assembly references
- Create your first .pptx presentation
- Load an existing presentation from a file or stream
- See a complete working example
Slides and Shapes
Refer to references/slides-and-shapes.md
When you need to:
- Add, remove, reorder, clone, or copy slides
- Add geometric shapes, picture shapes, or group shapes to a slide
- Position and size shapes (X, Y, Width, Height in document units)
- Configure shape fill (solid, gradient, pattern, picture) and outline
- Add and format text inside shapes (paragraphs, runs, font, bullets)
- Create and customize tables (rows, columns, cells, styles, borders)
- Set slide backgrounds
- Configure slide masters and layouts
Charts (v26.1+)
Refer to references/charts.md
When you need to:
- Add a standard chart (bar, line, pie, scatter, area, etc.) to a slide
- Add an Office 2016+ chart type (waterfall, funnel, treemap, sunburst, etc.)
- Configure chart data series with
ChartStringData and ChartNumericData
- Choose between
Chart (standard types) and ChartEx (Office 2016+ types)
- Customize individual data points (
CustomDataPoints, DataPoint, Marker, MarkerStyle)
- Configure the chart legend (position, appearance, custom entries)
Export
Refer to references/export.md
When you need to:
- Export a presentation to PDF
- Configure PDF export options (security, image optimization, signatures, attachments)
- Export slides to images (
DXImage[]) with configurable resolution (v26.1+)
- Merge two or more presentations
- Split a presentation into separate files
- Print a presentation
Advanced Features
Refer to references/advanced-features.md
When you need to:
- Add, edit, or remove speaker notes
- Configure slide headers and footers (footer text, date, slide number)
- Search, replace, or remove text across the presentation or a specific slide
- Extract text or images from slides programmatically
- Customize presentation themes (color scheme, font scheme)
- Configure view settings (active view, grid spacing, normal view layout)
- Read or set document properties (title, author, keywords, custom properties)
Quick Start Example
Create a presentation with a title slide and one content slide:
using DevExpress.Docs.Office;
using DevExpress.Docs.Presentation;
using System.Drawing;
Presentation presentation = new Presentation();
presentation.Slides.Clear();
SlideMaster master = presentation.SlideMasters[0];
master.Background = new CustomSlideBackground(new SolidFill(Color.FromArgb(230, 240, 255)));
Slide titleSlide = new Slide(master.Layouts.Get(SlideLayoutType.Title));
foreach (Shape shape in titleSlide.Shapes) {
if (shape.PlaceholderSettings.Type is PlaceholderType.CenteredTitle)
shape.TextArea = new TextArea("My Presentation");
if (shape.PlaceholderSettings.Type is PlaceholderType.Subtitle)
shape.TextArea = new TextArea("Created with DevExpress Presentation API");
}
presentation.Slides.Add(titleSlide);
Slide contentSlide = new Slide(master.Layouts.GetOrCreate(SlideLayoutType.Object));
foreach (Shape shape in contentSlide.Shapes) {
if (shape.PlaceholderSettings.Type is PlaceholderType.Title)
shape.TextArea = new TextArea("Key Points");
if (shape.PlaceholderSettings.Type is PlaceholderType.Body) {
TextArea body = new TextArea();
body.Paragraphs.Clear();
body.Paragraphs.Add(new TextParagraph("First bullet point"));
body.Paragraphs.Add(new TextParagraph("Second bullet point"));
body.Paragraphs.Add(new TextParagraph("Third bullet point"));
shape.TextArea = body;
}
}
presentation.Slides.Add(contentSlide);
presentation.HeaderFooterManager.AddSlideNumberPlaceholder(presentation.Slides);
using FileStream outStream = new FileStream("output.pptx", FileMode.Create);
presentation.SaveDocument(outStream);
What This Does
Creates a two-slide presentation with a styled blue background. The first slide is a title slide; the second slide has a title and a bullet list. The result is saved as output.pptx.
Key Properties & API Surface
Presentation
| Property/Method | Type | Description |
|---|
Slides | SlideCollection | Access all slides in the presentation |
SlideMasters | SlideMasterCollection | Access slide masters |
SlideSize | SlideSize | Get or set slide dimensions and orientation |
HeaderFooterManager | HeaderFooterManager | Manage headers and footers |
NotesMaster | NotesMaster | Access the notes master layout |
ViewProperties | ViewProperties | Configure view settings |
DocumentProperties | DocumentProperties | Access metadata (title, author, etc.) |
SaveDocument(Stream) | void | Save presentation to a stream |
ExportToPdf(string) | void | Export to PDF file path |
ExportToPdf(Stream, PdfExportOptions) | void | Export to PDF with options |
Print() | void | Print with default printer |
Print(PrintOptions) | void | Print with specified options |
FindText(string, TextSearchOptions) | IList<TextSearchInfo> | Search text across all slides |
ReplaceText(string, string, TextSearchOptions) | void | Replace text across all slides |
GetActualShapeBounds(Slide, Shape) | RectangleF | Get effective bounds of a shape |
Slide
| Property/Method | Type | Description |
|---|
Shapes | ShapeCollection | Shapes on this slide |
Background | SlideBackground | Slide background fill |
Notes | NotesSlide | Speaker notes for this slide |
Visible | bool | Whether the slide is shown during presentation |
ShowMasterShapes | bool | Whether master/layout shapes are inherited |
Clone() | Slide | Create a copy of this slide |
FindText(string, TextSearchOptions) | IList<TextSearchInfo> | Search text within this slide |
ReplaceText(string, string, TextSearchOptions) | void | Replace text within this slide |
ActualFooterPlaceholder | Shape | Footer placeholder shape |
ActualSlideNumberPlaceholder | Shape | Slide number placeholder shape |
ActualDateTimePlaceholder | Shape | Date/time placeholder shape |
Shape
| Property/Method | Type | Description |
|---|
X, Y | float | Top-left position in document units (1/300 inch) |
Width, Height | float | Size in document units |
Fill | OfficeFill | Fill style (SolidFill, GradientFill, etc.) |
Outline | LineStyle | Border/outline style |
TextArea | TextArea | Text content and formatting |
PlaceholderSettings | PlaceholderSettings | Placeholder type, index, size |
Effects | ShapeEffectProperties | Visual effects (shadow, glow, etc.) |
Name | string | Shape name |
Common Patterns
Add a Text Shape to a Slide
Shape shape = new Shape(ShapeType.Rectangle, x: 100, y: 100, width: 2000, height: 600);
shape.Fill = new SolidFill(Color.LightBlue);
shape.Outline = new LineStyle { Fill = new SolidFill(Color.SteelBlue), Width = 2 };
shape.TextArea = new TextArea("Hello, Presentation API!");
slide.Shapes.Add(shape);
Add a Table to a Slide
Table table = new Table(3, 4, 100f, 200f, 3000f, 1200f);
table.Style = new ThemedTableStyle(TableStyleType.LightStyle1Accent4);
table[0, 0].TextArea.Text = "Header 1";
table[0, 1].TextArea.Text = "Header 2";
table.HasHeaderRow = true;
slide.Shapes.Add(table);
Load, Modify, Save
Presentation presentation = new Presentation(File.ReadAllBytes("input.pptx"));
Slide slide = presentation.Slides[0];
foreach (Shape shape in slide.Shapes) {
if (shape is Shape s && s.TextArea != null)
s.TextArea.ReplaceText("old text", "new text");
}
using FileStream fs = new FileStream("output.pptx", FileMode.Create);
presentation.SaveDocument(fs);
Troubleshooting
| Symptom | Cause | Solution |
|---|
PresentationUnsupportedFormatException | File is not a valid PPTX/PPTM/POTX/POTM | Verify file format; only Open XML formats are supported |
InvalidOperationException on save | SlideMasters collection is empty | Always keep at least one SlideMaster in the presentation |
ArgumentOutOfRangeException on table access | Row or column index is out of range | Check table.Rows.Count and table.Columns.Count before indexing |
| SmartArt/Charts not in PDF export | Known limitation: these elements are not exported | Accepted limitation; use image workarounds if needed |
| Version mismatch error at build | Mixed DevExpress package versions | Ensure all DX packages use the exact same version (e.g., all 25.2.x) |
| License error at runtime | Missing or invalid DevExpress license | Register license key per the DevExpress installation guide |
| Shapes not visible on exported slide | Shape coordinates exceed slide bounds | Check Presentation.SlideSize and adjust shape X/Y/Width/Height |
Constraints & Rules
CRITICAL — follow these rules in every interaction:
- Build verification: After making changes, verify the project builds with
dotnet build. Check for errors before reporting success.
- NuGet packages: Use
DevExpress.Docs.Presentation for core features. Do not guess other package names.
- Namespace imports: Always include
using DevExpress.Docs.Presentation; and using DevExpress.Docs.Office; (for text types, fills, and effects). Add DevExpress.Docs.Presentation.Export and DevExpress.Docs.Presentation.Printing as needed.
- Version consistency: All DevExpress packages must use the same version.
- License: DevExpress requires a valid license. Remind the developer if they encounter license-related errors.
- No destructive changes: Preserve existing code structure. Only add or modify what is necessary.
- Framework detection: Check the project's .csproj for target framework. The Presentation API supports .NET 6+ and .NET Framework 4.6.2+.
- Coordinate units: Shape position and size values use document units (1/300 inch). Use appropriate values for visible placement on a typical widescreen slide (default: ~4000 x 2250 units).
Using DevExpress Documentation MCP
If the DxDocs MCP server is available, use it to supplement this skill:
- Search: Use
devexpress_docs_search with technology "Presentation API" and your question.
- Fetch: Use
devexpress_docs_get_content with a documentation URL to get full article content.
When to use MCP vs. built-in references:
- Built-in references: Getting started, common patterns, key properties, troubleshooting.
- MCP search: Advanced scenarios not covered here, version-specific changes, uncommon features, or when the developer asks about something outside this skill's references.
- Always MCP for: Exact method signatures, event args, or enum values when you are not 100% certain.
Next Steps
Start with Getting Started to install and configure the Presentation API, then explore specific features through the navigation guide above.