Category Archives: animation

Apache POI XSLF: How to Copy Animations?

Copy Power Point Shape Animations

I have a PowerPoint template and want to duplicate some slides and change the text in it with apache poi dynamicly. I want to copy all the formatting and animations of the textshapes etc. so I can save time when creating and redesigning my template. By now I duplicate like this:

void copySlideAndChangeText(XSLFSlide srcSlide, XMLSlideShow destSlideShow, ArrayList<Integer> replaceIndexes){
    Dimension pageSize = srcSlide.getSlideShow().getPageSize();

    XSLFSlide newSlide = destSlideShow.createSlide();

    XSLFSlideLayout src_sl = srcSlide.getSlideLayout();
    XSLFSlideMaster src_sm = srcSlide.getSlideMaster();

    XSLFSlideLayout new_sl = newSlide.getSlideLayout();
    XSLFSlideMaster new_sm = newSlide.getSlideMaster();

    // copy source layout to the new layout
    // copy source master to the new master


It works fine for the Page Size and the Content but all animations get lost and even the global animations between the slides.

How can I keep the animations when copying?