Export presentations to HTML
Overview
Save a presentation as HTML so readers can open it in a browser. Classic HTML export can package slide content into a self-contained document, using SVG for the slide body. Choose the output options to suit how your application stores and serves the result.
Usage example
This C# example uses Aspose.Slides for .NET. It creates two slides labeled Alpha and Bravo and generates a small PNG for the first slide. Classic HTML export writes slides.html with embedded SVG content and the picture, while source.pptx keeps the editable source.
For setup, see Install Aspose.Slides for .NET.
using System.Drawing;
using System.IO;
using Aspose.Slides;
using Aspose.Slides.Export;
using var presentation = new Presentation();
for (var i = 0; i < 2; i++)
{
var slide = i == 0 ? presentation.Slides[0] : presentation.Slides.AddEmptySlide(presentation.Slides[0].LayoutSlide);
var title = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 40, 40, 500, 80);
title.TextFrame.Text = i == 0 ? "Alpha" : "Bravo";
}
using (var bitmap = new Bitmap(32, 32))
{
using var graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.Green);
bitmap.Save("picture.png", System.Drawing.Imaging.ImageFormat.Png);
}
var pictureBytes = File.ReadAllBytes("picture.png");
var picture = presentation.Images.AddImage(pictureBytes);
presentation.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 40, 160, 80, 80, picture);
presentation.Save("source.pptx", SaveFormat.Pptx);
presentation.Save("slides.html", SaveFormat.Html);
FAQ
Which export should I use for animation?
See HTML5 export for browser navigation and supported animation. Its output and script dependencies differ from classic HTML.
Which files must I publish with the HTML?
Publish the HTML and any resource files generated by your chosen options. Classic export can embed resources; if you select external resources, retain their relative paths when hosting them.
Can I export a selected slide range to HTML?
Yes. Use the selected-slides save overload with one-based slide numbers. See the HTML guide for selection and resource options.
Guides
Related feature: Export presentations to HTML5.