package com.aspose.slides.examples.Slides.CRUD;

import com.aspose.slides.IMasterSlide;
import com.aspose.slides.IMasterSlideCollection;
import com.aspose.slides.ISlide;
import com.aspose.slides.ISlideCollection;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import com.aspose.slides.examples.Utils;

public class CloneASlideWithMasterSlideFromOnePresentationToAnother {

	public static void main(String[] args) {
		
		// The path to the documents directory.
		String dataDir = Utils.getDataDir(CloneASlideWithMasterSlideFromOnePresentationToAnother.class);
		
		// Instantiate Presentation class to load the source presentation file
		Presentation srcPres = new Presentation(dataDir + "Presentation.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(dataDir + "helloworld_dest3.pptx", SaveFormat.Pptx);

	}

}

@@ -1300,554 +1300,149 @@
 %0A%0A%09%09
-// Clone the desired master slide from the source presentation to the collection of masters in the destination presentation%0A%09%09IMasterSlide iSlide = masters.addClone(SourceMaster);%0A%0A%09%09// Clone the desired slide from the source presentation with the desired master to the end of the collection of slides in the destination presentation%0A%09%09ISlideCollection slds = destPres.getSlides();%0A%09%09slds.addClone(sourceSlide, iSlide);%0A%0A%09%09// Clone the desired master slide from the source presentation to the collection of masters in the destination presentation
+IMasterSlide iSlide = masters.addClone(SourceMaster);%0A%0A%09%09ISlideCollection slds = destPres.getSlides();%0A%09%09slds.addClone(sourceSlide, iSlide);%0A
 %0A%09%09/

Update CloneASlideWithMasterSlideFromOnePresentationToAnother.java