Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active January 4, 2022 13:22
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/ede3f01641aca14a3dbda2812f54e67e to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ede3f01641aca14a3dbda2812f54e67e to your computer and use it in GitHub Desktop.
Split Slides in PowerPoint PPT/PPTX in Python
import aspose.slides as slides
# Load presentation
ppt = slides.Presentation("presentation.pptx")
# Loop through slides
for index in range(ppt.slides.length):
# Create a new empty presentation
with slides.Presentation() as newPpt:
# Remove default slide
newPpt.slides[0].remove()
# Add slide to presentation
newPpt.slides.add_clone(ppt.slides[index])
# Save presentation
newPpt.save("slide_{i}.pptx".format(i = index), slides.export.SaveFormat.PPTX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment