I'm using Apache POI - 5.2.2 to load the decks as ByteArrayInputStream. These loaded decks to be merged to a single large deck. I'm following mentioned steps -
- Download the file as ByteArrayOutputStream
- Convert the downloaded file to InputStream
- Load the deck in Apache POI
XMLSlideShow slideShow = new XMLSlideShow(stream);
- Iterating over each slide from the loaded deck
slideShow.getSlides();
- Create a new slide in the Target Deck
targetDeck.createSlide()// Another method is available but doesn't work for the layoutstargetDeck.createSlide(srcSlide.getSlideLayout); //
- Tried importing content and layout from srcSlide to targetDeck Slide
XSLFSlide newSlide = targetDeck.createSlide(srcSlide.getSlideLayout()); // copy source layout to the new layout newSlide.getSlideMaster().importContent(srcSlide.getSlideMaster()); newSlide.getSlideLayout().importContent(srcSlide.getSlideLayout()); newSlide.importContent(srcSlide);
After all mentioned steps, when I try to output the targetDeck as stream, it doesn't retain any source layouts.