Introduction
Aspose.Slides FOSS for .NET (Aspose.Slides.Foss on NuGet) is a free, MIT-licensed
library for creating and editing PowerPoint .pptx files entirely in C#. It runs on
Windows, macOS, Linux, and Docker containers with no dependency on Microsoft Office.
This article walks through the key features available in the current release.
Key Features
Presentation Loading and Saving
Presentation is the root object. Construct it with no arguments to create a new file
or pass a file path to load an existing one. Call Save() with a path and SaveFormat
to write the output. Use using to ensure resources are released:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
// Create new
using var prs = new Presentation();
prs.Save("output.pptx", SaveFormat.Pptx);
// Load and save
using var prs2 = new Presentation("existing.pptx");
prs2.Save("copy.pptx", SaveFormat.Pptx);
Slide Management
The Slides property returns the slide collection. Add slides with AddEmptySlide(),
remove them with Remove(), and access existing slides by index:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var slide = prs.Slides[0]; // First slide (created automatically)
// Add a second slide using the first master/layout
var layout = prs.Masters[0].LayoutSlides[0];
var newSlide = prs.Slides.AddEmptySlide(layout);
prs.Save("two_slides.pptx", SaveFormat.Pptx);
AutoShape Insertion and Text
Add shapes using slide.Shapes.AddAutoShape(). Capture the returned ITextFrame
from AddTextFrame() to set text content and apply character formatting:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var slide = prs.Slides[0];
var shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 300, 100);
var tf = shape.AddTextFrame("Hello from Aspose.Slides FOSS");
var fmt = tf.Paragraphs[0].Portions[0].PortionFormat;
fmt.FontHeight = 24;
fmt.FontBold = NullableBool.True;
prs.Save("shape_demo.pptx", SaveFormat.Pptx);
Solid and Gradient Fills
Apply FillType.Solid with an ARGB color or FillType.Gradient for multi-stop fills:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 400, 200);
shape.FillFormat.FillType = FillType.Solid;
shape.FillFormat.SolidFillColor.Color = Color.FromArgb(255, 70, 130, 180);
prs.Save("solid_fill.pptx", SaveFormat.Pptx);
Visual Effects
Apply outer shadows, glow, and soft-edge effects via shape.EffectFormat:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 300, 150);
var ef = shape.EffectFormat;
ef.EnableOuterShadowEffect();
ef.OuterShadowEffect.BlurRadius = 8;
ef.OuterShadowEffect.Distance = 6;
ef.OuterShadowEffect.Direction = 45;
ef.OuterShadowEffect.ShadowColor.Color = Color.FromArgb(128, 0, 0, 0);
prs.Save("shadow.pptx", SaveFormat.Pptx);
Quick Start
Install from NuGet (.NET 9.0 or later required):
dotnet add package Aspose.Slides.Foss
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 400, 150);
shape.AddTextFrame("My first slide");
prs.Save("first.pptx", SaveFormat.Pptx);
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| PowerPoint (OOXML) | .pptx | ✓ | ✓ |
Open Source & Licensing
Aspose.Slides FOSS for .NET is released under the MIT License. Install from NuGet
as Aspose.Slides.Foss. Commercial use, redistribution, and modification are all permitted.