Frequently Asked Questions
Frequently Asked Questions
How do I install Aspose.Slides FOSS?
Install from NuGet using the .NET CLI. .NET 9.0 or later is required.
dotnet add package Aspose.Slides.FossVerify the installation:
using Aspose.Slides.Foss;
using var prs = new Presentation();
Console.WriteLine($"Slides: {prs.Slides.Count}");No Microsoft Office or other system runtime is required.
Why must I use using var prs = new Presentation();?
The Presentation class implements IDisposable and manages internal XML resources. Without a using statement, those resources are not released when the Presentation object goes out of scope, which can cause resource leaks or file locks.
Always follow this pattern:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation("input.pptx");
// work here
prs.Save("output.pptx", SaveFormat.Pptx);What file formats can I save to?
Only PPTX is supported:
using Aspose.Slides.Foss.Export;
prs.Save("output.pptx", SaveFormat.Pptx);Export to PDF, HTML, SVG, or image formats (PNG, JPEG) is not available in this edition.
Can I open .ppt (old PowerPoint 97-2003) files?
No. Only .pptx (Office Open XML) files are supported. Legacy .ppt binary format is not handled by this library.
How do I access slides?
Slides are a zero-based collection accessible via prs.Slides:
var firstSlide = prs.Slides[0];
int slideCount = prs.Slides.Count;How do I add a second slide?
Use prs.Slides.AddEmptySlide() with a layout:
using var prs = new Presentation();
var layout = prs.LayoutSlides[0];
prs.Slides.AddEmptySlide(layout);
var slide2 = prs.Slides[1];
prs.Save("two-slides.pptx", SaveFormat.Pptx);How do I set the slide background color?
Access slide.Background.FillFormat:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
slide.Background.FillFormat.FillType = FillType.Solid;
slide.Background.FillFormat.SolidFillColor.Color = Color.FromArgb(255, 230, 240, 255);How do I use NullableBool?
NullableBool is a tri-state enum used for formatting properties. Use NullableBool.True (not C#’s true) for bold, italic, and similar properties:
using Aspose.Slides.Foss;
fmt.FontBold = NullableBool.True;
fmt.FontItalic = NullableBool.False;
fmt.FontUnderline = TextUnderlineType.Single;Why does setting text color have no effect?
You must also set FillType = FillType.Solid before assigning the color:
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
fmt.FillFormat.FillType = FillType.Solid;
fmt.FillFormat.SolidFillColor.Color = Color.FromArgb(255, 200, 0, 0);Can I use charts or SmartArt?
No. Charts, SmartArt, OLE objects, animations, transitions, hyperlinks, VBA macros, and digital signatures are not implemented in this edition.
Does the library support .NET 8?
No. .NET 9.0 or later is required.
Is this library thread-safe?
Each Presentation object is independent. Creating and using separate Presentation instances from separate threads is safe as long as you do not share a single Presentation object across threads without external locking.
How do I embed an image?
Read the image bytes and add them to prs.Images, then create a PictureFrame:
byte[] imageData = File.ReadAllBytes("logo.png");
var image = prs.Images.AddImage(imageData);
slide.Shapes.AddPictureFrame(ShapeType.Rectangle, 50, 50, 200, 150, image);