Is there any way to completely copy a slide from one slideshow to another slideshow including all of the box locations, colors, fonts, etc.?
Referencing the cookbook I have the below
private void copySlides(XMLSlideShow fromPptx, XMLSlideShow toPptx) {
for(XSLFSlide fromSlide : fromPptx.getSlides()){
toPptx.createSlide().importContent(fromSlide);
}
}
However the background doesn't match the 'from' pptx and the a number of the text boxes are shifted. I'm guessing the colors are due to me not modifying the master and the shift is because something related to the anchors. I have also tried what I thought would force the master of one slide onto the other, but it does the same thing as above.
private void copySlides(XMLSlideShow fromPptx, XMLSlideShow toPptx) {
for(XSLFSlide fromSlide : fromPptx.getSlides()){
XSLFSlide toSlide = toPptx.createSlide();
copySlide(fromSlide, toSlide);
toSlide.importContent(fromSlide);
}
}
private static void copySlide(
final XSLFSlide fromSlide, final XSLFSlide toSlide) {
XSLFSlideLayout fromLayout = fromSlide.getSlideLayout();
XSLFSlideMaster fromMaster = fromSlide.getSlideMaster();
XSLFSlideLayout toLayout = toSlide.getSlideLayout();
XSLFSlideMaster toMaster = toSlide.getSlideMaster();
toLayout.importContent(fromLayout);
toMaster.importContent(fromMaster);
}