Remove a Design from a PPTX File in Python

Hello!

I am using the split function in the python sdk to split each slide in a powerpoint file into a new pptx file. However when I do this the new files now have 2 designs: the original one that was on the original slide, and a new design (I think it’s the default design).

This new design is not visible; the correct design is still active. Still, I would like to remove this new unnecessary design. Is there a way to do this?

@jamieMacabacus

To remove the unnecessary design that appears in the new PPTX files created from splitting slides, you can utilize the Aspose.Slides Cloud API to delete unused layout slides. This can help you eliminate any default designs that are not actively used in your presentation.

Here’s how you can do it using the API:

  1. Delete Unused Layout Slides: You can send a DELETE request to the API endpoint that handles layout slides. This will remove any layout slides that are not in use, including the unwanted default design.

Example Code in Python

Here’s a sample code snippet that demonstrates how to delete unused layout slides using the Aspose.Slides Cloud SDK for Python:

import asposeslidescloud
from asposeslidescloud.configuration import Configuration
from asposeslidescloud.apis.slides_api import SlidesApi

# Configuration
configuration = Configuration()
configuration.app_sid = 'YourClientId'
configuration.app_key = 'YourClientSecret'

# Create an instance of the Slides API
api = SlidesApi(configuration)

# Delete unused layout slides from the presentation
result = api.delete_unused_layout_slides("YourPresentation.pptx")

# Output the number of layout slides removed
print(f"Number of unused layout slides removed: {len(result.slide_list)}")

Steps to Follow:

  • Replace 'YourClientId' and 'YourClientSecret' with your actual API credentials.
  • Replace "YourPresentation.pptx" with the name of your PowerPoint file.

This approach will help you clean up your presentation by removing any layout slides that are not being used, thus eliminating the unnecessary design that you mentioned.

For more detailed information, you can refer to the official documentation on deleting unused layout slides here for further guidance.

If you have any more questions or need further assistance, feel free to ask!

Layout slides are separate from designs. Calling delete_unused_layout_slides did not resolve the problem.

@jamieMacabacus,
I’ve reproduced the design issue that occurs when splitting slides from a PowerPoint presentation into separate presentations.

I was able to remove the additional design using the method delete_unused_master_slides. Could you please test this solution for your purposes?

1 Like

That worked perfectly. Thank you!

@jamieMacabacus,
We are glad that the issue has been resolved on your end. Thank you for using Aspose.Slides Cloud.