Learn how to merge PowerPoint PPT/PPTX presentations in Python: https://blog.aspose.com/2022/01/25/merge-powerpoint-ppt-in-python/
Last active
January 25, 2022 15:32
-
-
Save aspose-com-gists/603b0e997ea07b37a82d910a1c03d3b1 to your computer and use it in GitHub Desktop.
Merge PowerPoint PPT/PPTX Presentations in Python
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
import aspose.slides as slides | |
# open first PPT | |
with slides.Presentation("Presentation1.pptx") as pres1: | |
# open second PPT | |
with slides.Presentation("Presentation2.pptx") as pres2: | |
# loop through slides | |
for slide in pres2.slides: | |
# clone slide | |
pres1.slides.add_clone(slide, pres1.masters[0], allow_clone_missing_layout = True) | |
# save merged PPT | |
pres1.save("combined.pptx", slides.export.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
import aspose.slides as slides | |
# open first PPT | |
with slides.Presentation("Presentation1.pptx") as pres1: | |
# open second PPT | |
with slides.Presentation("Presentation2.pptx") as pres2: | |
# loop through slides | |
for slide in pres2.slides: | |
# clone slide | |
pres1.slides.add_clone(slide, pres1.sections[0]) | |
# save merged PPT | |
pres1.save("combined.pptx", slides.export.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
import aspose.slides as slides | |
# open first PPT | |
with slides.Presentation("Presentation1.pptx") as pres1: | |
# open second PPT | |
with slides.Presentation("Presentation2.pptx") as pres2: | |
# change size of slides | |
pres2.slide_size.set_size(pres1.slide_size.size.width, pres1.slide_size.size.height, slides.SlideSizeScaleType.ENSURE_FIT) | |
# loop through slides | |
for slide in pres2.slides: | |
# clone slide | |
pres1.slides.add_clone(slide) | |
# save merged PPT | |
pres1.save("combined.pptx", slides.export.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
import aspose.slides as slides | |
# open first PPT | |
with slides.Presentation("presentation1.pptx") as pres1: | |
# open second PPT | |
with slides.Presentation("Presentation2.pptx") as pres2: | |
# loop through slides | |
for slide in pres2.slides: | |
# clone slide | |
pres1.slides.add_clone(slide) | |
# save merged PPT | |
pres1.save("combined.pptx", slides.export.SaveFormat.PPTX) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment