Hello,
We’re trying (evaluating) with Aspose Slides for Java, version 14.5.0, to copy (clone) a slide with a layout from one presentation to a new presentation. We’ve used the example “In Another Presentation with Master Slide from Source Presentation at the End of the Existing Slides” on page Clone Slides|Aspose.Slides Documentation. Unfortunately, the result slide has not the same layout as the original. What are we doing wrong? Are we missing something?
This is our code:
import com.aspose.slides.*;
public class CopyOneSlide {
public static void main(String[] args) {
//Instantiate Presentation class to load the source presentation file
Presentation srcPres = new Presentation("Welkom bij PowerPoint.pptx");
//Instantiate Presentation class for destination presentation (where slide is to be cloned)
Presentation destPres = new Presentation();
//Instantiate ISlide from the collection of slides in source presentation along with
//master slide
ISlide SourceSlide = srcPres.getSlides().get_Item(0);
//Clone the desired master slide from the source presentation to the collection of masters in the
//destination presentation
IMasterSlideCollection masters = destPres.getMasters();
IMasterSlide SourceMaster = SourceSlide.getLayoutSlide().getMasterSlide();
//Clone the desired master slide from the source presentation to the collection of masters in the
//destination presentation
IMasterSlide iSlide = masters.addClone(SourceMaster);
//Clone the desired slide from the source presentation with the desired master to the end of the
//collection of slides in the destination presentation
ISlideCollection slds = destPres.getSlides();
slds.addClone(SourceSlide, iSlide);
//Clone the desired master slide from the source presentation to the collection of masters in the//destination presentation
//Save the destination presentation to disk
destPres.save("welkom.pptx", SaveFormat.Pptx);
}
}
Tia,
Michelle
Sendrata