Cloning Slides in PowerPoint Presentation in Java Does Not Work Correctly

files.zip (572.8 KB)

public final class Test {
    public static void main(String[] args) {
        com.aspose.slides.License license = new com.aspose.slides.License();
        license.setLicense("Aspose.Slides.Java.lic");
    
        try {
            String dataDir = new File(".").getAbsolutePath() + File.separator;
            Presentation inPres = new Presentation(dataDir+"in.potx");
            Presentation  outPres = new Presentation(dataDir+"newlayout.potx");
            //add first slide of inPres to outPres using the first layout of outPres            
            outPres.getSlides().addClone(inPres.getSlides().get_Item(0),outPres.getLayoutSlides().get_Item(0));
            outPres.save(dataDir + "out.pptx", SaveFormat.Pptx);            

        }
        catch( Exception e){
            System.out.println("Error  Exception in code: "+e.getMessage());
            System.exit(1) ;
        }
    }
}

Hi, I think there’s a bug in ISlideCollection.addClone
see attached files
out.pptx has a duplicated shape in rather than the correct text place holder (with an svg background)

resetting the layout of slide1 in out.pptx in PowerPoint will produce the result I was expecting
(and is what happens if you manually do the operation in powerpoint via cut an paste use destination theme)

@JamesDriscoll,
Thank you for the code and presentation examples. I have reproduced the problem and got the same results. I have logged the issue in our tracking system with ID SLIDESJAVA-38440. Our development team will investigate the issue. You will be notified when it is fixed.

1 Like

The issues you have found earlier (filed as SLIDESJAVA-38440) have been fixed in this update.

1 Like