Reputation: 1
I want to split a pptx slideshow into several slideshows each containing only one slide by using the Apache POI Java library.
Creating a new XMLSlideSheet and adding a slide as described in several places(e.g. https://www.tutorialspoint.com/apache_poi_ppt/apache_poi_ppt_merging.htm) does not work for me, as some of the layout is not imported correctly: Fonts are changed, positioning of text is changed, etc.
One thing that does work is importing the pptx file one time for each slide and then iterating over all slides, deleting all but one single slide. However, the drawback of this approach so far is, that the file size of the resulting pptx-one-slide-file is as large as the big input slidedeck with x slides. Thus, deleting a slide via XMLSlideShow -> removeSlide(slideID) seems to not remove all images, relations, etc. from the slideshow.
Thank you for you help!
Upvotes: 0
Views: 564
Reputation: 237
Start by opening the full pptx and removing slides from it one-by-one. That way you preserve master slides and other properties.
You can try a cycle on the shapes of the slide and remove them, something like this:
for (shape: slide.getShapes()) { slide.removeShape(shape) }
Upvotes: 0