Clone Slide to Specified Position using Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Clone Slide to Specified Position
If you want to clone a slide and then use it within the same presentation file but at a different position, use the InsertClone method:
- Create an instance of the Presentation class.
- Instantiate the ISlideCollection class by referencing the Slides collection exposed by thePresentation object.
- Call the InsertClone method exposed by the ISlideCollection object and pass the slide to be cloned along with the index for the new position as a parameter to the InsertClonemethod.
- Write the modified presentation as a PPTX file.
Java
//Instantiate Presentation class that represents a presentation file
Presentation pres = new Presentation(dataDir + "presentation.pptx");
//Clone the desired slide to the end of the collection of slides in the same presentation
ISlideCollection slds = pres.getSlides();
//Clone the desired slide to the specified index in the same presentation
slds.insertClone(2, pres.getSlides().get_Item(1));
Download Running Code
Download Sample Code
For more details, visit Cloning Slides in Presentation.