I guess the bug was introduced by commit 1620997 (Bug 56854 - XMLBeans performance when using getXXXList() and other proxy methods). Tested with version 3.11-beta3. The setSlideOrder() method removes old slide at wrong position: after insert: <xml-fragment xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"> <p:sldId id="257" r:id="rId7"/> <p:sldId id="256" r:id="rId2"/> <p:sldId id="257" r:id="rId7"/> </xml-fragment> after remove: <xml-fragment xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"> <p:sldId id="257" r:id="rId7"/> <p:sldId id="257" r:id="rId7"/> </xml-fragment> Finally the presentation refers to the same slide twice and the old slide is not more reachable. The following unit test fails (create a slide show insert-infront.pptx with a single slide containing text "Test me"): @Test public void testInsertInfront() throws Exception { XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("insert-infront.pptx"); XSLFSlide slide; assertEquals(1, ss.getSlides().length); slide = ss.getSlides()[0]; assertContains(getSlideText(slide), "Test me"); slide = ss.createSlide(); ss.setSlideOrder(slide, 0); slide.createTextBox().setText("New slide"); // Save and re-load ss = XSLFTestDataSamples.writeOutAndReadBack(ss); assertEquals(2, ss.getSlides().length); slide = ss.getSlides()[0]; assertContains(getSlideText(slide), "New slide"); slide = ss.getSlides()[1]; assertContains(getSlideText(slide), "Test me"); }
I will fix as soon as Apache SVN server comes back.
Created attachment 32266 [details] Fix for bug 57250
Thank you for the patch. Applied with r1643684