Aspose.Slides.Examples.CSharp.Slides.CRUD.CloneAnotherPresentationAtSpecifiedPosition.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations_CRUD();

            // ExStart:CloneAnotherPresentationAtSpecifiedPosition
            // Instantiate Presentation class to load the source presentation file
            using (Presentation sourcePresentation = new Presentation(dataDir + "AccessSlides.pptx"))
            {
                // Instantiate Presentation class for destination presentation (where slide is to be cloned)
                using (Presentation destPres = new Presentation())
                {
                    // Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation
                    ISlideCollection slideCollection = destPres.Slides;

                    // Clone the desired slide from the source presentation to the specified position in destination presentation
                    slideCollection.InsertClone(1, sourcePresentation.Slides[1]);

                    // ExEnd:CloneAnotherPresentationAtSpecifiedPosition
                    // Write the destination presentation to disk
                    destPres.Save(dataDir + "CloneAnotherPresentationAtSpecifiedPosition_out.pptx", SaveFormat.Pptx);
                }
            }
        }
    }
CloneAnotherPresentationAtSpecifiedPosition