Quick Start
Quick Start
This guide shows the fastest path from installation to a saved .pptx file using
Aspose.Slides FOSS for .NET. The library is MIT-licensed, requires no Microsoft Office,
and runs on .NET 9.0 or later across Windows, macOS, and Linux.
Prerequisites
| Requirement | Detail |
|---|---|
| .NET | 9.0 or later |
| OS | Windows, macOS, Linux, Docker |
| Package | Aspose.Slides.Foss from NuGet |
Install
Install the package from NuGet. Always use the using statement with Presentation
since it implements IDisposable:
dotnet add package Aspose.Slides.FossCreate a Presentation
Construct a Presentation with no arguments to create a blank deck. The library
automatically adds one empty slide. Call Save() with a path and SaveFormat.Pptx:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
prs.Save("empty.pptx", SaveFormat.Pptx);Add a Shape with Text
Access the first slide via prs.Slides[0], insert a rectangle with Shapes.AddAutoShape(),
then attach text via shape.AddTextFrame() and set font properties on PortionFormat:
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, 400, 150);
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("with_shape.pptx", SaveFormat.Pptx);Apply a Solid Fill
Set FillFormat.FillType = FillType.Solid on the shape and supply an ARGB color via
Color.FromArgb(). The fill is written to the .pptx file when Save() is called:
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);
shape.AddTextFrame("Styled shape");
prs.Save("styled.pptx", SaveFormat.Pptx);Load an Existing File
Pass a file path to the Presentation constructor to open an existing .pptx file.
Read the slide count, modify the deck as needed, then call Save() to write the output:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation("existing.pptx");
Console.WriteLine($"Slides: {prs.Slides.Count}");
prs.Save("copy.pptx", SaveFormat.Pptx);