Aspose.Slides.Examples.CSharp.Slides.CRUD.AddSlides.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();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            // Instantiate Presentation class that represents the presentation file
            using (Presentation pres = new Presentation())
            {
                // Instantiate SlideCollection calss
                ISlideCollection slds = pres.Slides;

                for (int i = 0; i < pres.LayoutSlides.Count; i++)
                {
                    // Add an empty slide to the Slides collection
                    slds.AddEmptySlide(pres.LayoutSlides[i]);

                }

                // Save the PPTX file to the Disk
                pres.Save(dataDir + "EmptySlide_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

            }
        }
    }
AddSlides