You can find detailed information at: Clone Slides in PowerPoint Presentations using C++
Last active
September 30, 2021 11:01
-
-
Save aspose-com-gists/724b75c8a9bfaec816cedc23d3db0768 to your computer and use it in GitHub Desktop.
Clone Slides in PowerPoint Presentations using C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File paths | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; | |
const String outputFilePath = u"OutputDirectory\\CloneSlideAtEnd_out.pptx"; | |
// Load the presentation | |
auto presentation = System::MakeObject<Presentation>(sourceFilePath); | |
// Retrieve the slides | |
auto slides = presentation->get_Slides(); | |
// Add the slide clone | |
slides->AddClone(presentation->get_Slides()->idx_get(0)); | |
// Save the presentation | |
presentation->Save(outputFilePath, SaveFormat::Pptx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File paths | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; | |
const String destinationFilePath = u"SourceDirectory\\Slides\\SamplePresentation2.pptx"; | |
const String outputFilePath = u"OutputDirectory\\CloneSlideToOtherPresentationAtEnd_out.pptx"; | |
// Load the source presentation | |
auto sourcePresentation = System::MakeObject<Presentation>(sourceFilePath); | |
// Load the destination presentation | |
auto destinationPresentation = System::MakeObject<Presentation>(destinationFilePath); | |
// Get the slides of the destination presentation | |
auto destinationSlides = destinationPresentation->get_Slides(); | |
// Add slide from the source presentation to the end of the destination presentation | |
destinationSlides->AddClone(sourcePresentation->get_Slides()->idx_get(0)); | |
// Save the destination presentation | |
destinationPresentation->Save(outputFilePath, SaveFormat::Pptx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File paths | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; | |
const String outputFilePath = u"OutputDirectory\\CloneSlideAtSpecificIndex_out.pptx"; | |
// Load the presentation | |
auto presentation = System::MakeObject<Presentation>(sourceFilePath); | |
// Retrieve the slides | |
auto slides = presentation->get_Slides(); | |
// Insert the clone at 0 index | |
slides->InsertClone(0, presentation->get_Slides()->idx_get(1)); | |
// Save the presentation | |
presentation->Save(outputFilePath, SaveFormat::Pptx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File paths | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; | |
const String destinationFilePath = u"SourceDirectory\\Slides\\SamplePresentation2.pptx"; | |
const String outputFilePath = u"OutputDirectory\\CloneSlideToOtherPresentationAtSpecificIndex_out.pptx"; | |
// Load the source presentation | |
auto sourcePresentation = System::MakeObject<Presentation>(sourceFilePath); | |
// Load the destination presentation | |
auto destinationPresentation = System::MakeObject<Presentation>(destinationFilePath); | |
// Get the slides of the destination presentation | |
auto destinationSlides = destinationPresentation->get_Slides(); | |
// Insert slide from the source presentation to the 2nd index of the destination presentation | |
destinationSlides->InsertClone(2, sourcePresentation->get_Slides()->idx_get(0)); | |
// Save the destination presentation | |
destinationPresentation->Save(outputFilePath, SaveFormat::Pptx); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment