I want to split and save one PPT into multiple HTML. If I set up a section in PPT, can the section be recognized in the converted HTML? When sections are divided in HTML, I want to create separate HTML files for each section. Is there anyone who can help?
@Tyler_S,
Thank you for posting the question.
You can use Presentation.getSections()
, ISection.getSlidesListOfSection()
, ISlide.getSlideNumber()
, and Presentation.save(String, int[], int)
methods to split and save presentation slides from sections into different HTML files as follows:
var inputFilePath = "sample.pptx";
var outputFilePathTemplate = "%s.html";
var presentation = new Presentation(inputFilePath);
for (var section : presentation.getSections()) {
var sectionSlides = section.getSlidesListOfSection();
if (sectionSlides.size() == 0) continue;
var i = 0;
var slideNumbers = new int[sectionSlides.size()];
for (var slide : sectionSlides) {
slideNumbers[i++] = slide.getSlideNumber();
}
var outputFilePath = String.format(outputFilePathTemplate, section.getName());
presentation.save(outputFilePath, slideNumbers, SaveFormat.Html);
}
presentation.dispose();
More examples: