How to Convert Each Slide of a PPT to an HTML File?

I am trying to convert a PowerPoint such that each slide of the PowerPoint becomes it’s own html file. But when I try to convert it through the code, each slide is included in each of the output files. I am using the latest version of Aspose (22.2.0.0)

This is the sample powerpoint:
video_and_some_text.zip (2.9 MB)

This is the output:

htmlOutPut.zip (2.1 MB)
As you can see the output has 2 html files but instead of having each contain the contents of the corresponding slides. Both files contain both slides.

And this is my code.

 using (Presentation presentation = new Presentation(sourceFile))
                    {
                        ResponsiveHtmlController controller = new ResponsiveHtmlController();
                        HtmlOptions htmlOptions = new HtmlOptions { SvgResponsiveLayout = true};


                        for (int i = 0; i < presentation.Slides.Count; i++)
                        {
                            
                            presentation.Save(destDir + @"\Slide" + (i + 1) + ".html", SaveFormat.Html5, htmlOptions);
                            //presentation.Save(destDir + @"\Slide" + (i + 1) + ".html", new[] { i + 1 }, SaveFormat.Html, htmlOptions);
                        }
                    }

We are looking to upgrade our current license, but before we do so, I need to sort out these details.

Thanks!

Chelsey

@chelynnfoster,
Thank you for contacting support. We will reply to you as soon as possible.

@chelynnfoster,
I’ve reproduced the problem with converting each slide to a separate HTML5 document and added a ticket with ID SLIDESNET-43120 to our issue tracking system. We apologize for any inconvenience. Our development team will investigate this case. You will be notified when the issue is resolved.

1 Like

Hi Andrey,

Do you know what the timeline for this kind of fix might be? We are hoping to purchase the license in the next month, but we need this issue to be resolved first.

Thanks!

Chelsey

@chelynnfoster,
I’ve requested plans from our development team on this issue for you. We will let you know as soon as possible.

@chelynnfoster,
Our development team investigated the issue. To convert each slide to HTML5 document, please use the following code example:

using (var presentation = new Presentation("video_and_some_text.pptx"))
{
    var slideSize = presentation.SlideSize.Size;

    Aspose.Slides.LowCode.ForEach.Slide(presentation, (slide, index) =>
    {
        using (var clone = new Presentation())
        {
            clone.Slides.RemoveAt(0);
            clone.SlideSize.SetSize(slideSize.Width, slideSize.Height, SlideSizeScaleType.DoNotScale);
           
            clone.Slides.AddClone(slide);
            clone.Save("Slide" + (index + 1) + "_out.html", SaveFormat.Html5);
        }
    });
}

Documents: Clone Slides
API Reference: ISlideCollection Interface

The issues you have found earlier (filed as SLIDESNET-43120) have been fixed in Aspose.Slides for .NET 22.4 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.