Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active September 22, 2021 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/77104b44d5371e3944d2f7d2e9b3a6de to your computer and use it in GitHub Desktop.
Save aspose-com-gists/77104b44d5371e3944d2f7d2e9b3a6de to your computer and use it in GitHub Desktop.
Split PowerPoint Presentations using C++
// Source file path
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx";
// Load the presentation file
auto presentation = System::MakeObject<Presentation>(sourceFilePath);
// Loop through the slides
for (SharedPtr<ISlide> slide : presentation->get_Slides())
{
// Create an instance of the Presentation class
auto newPresentation = System::MakeObject<Presentation>();
// Remove the default slide
newPresentation->get_Slides()->idx_get(0)->Remove();
// Add the slide to presentation
newPresentation->get_Slides()->AddClone(slide);
// Save the presentation
newPresentation->Save(String::Format(u"OutputDirectory\\SplitPresentation_out_{0}.pptx", slide->get_SlideNumber()), SaveFormat::Pptx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment