Microsoft PowerPoint

Microsoft PowerPoint to OpenDocument / Convert MS PowerPiont (PPTX) to ODP format

PPTX file is one of the leading PowerPoint formats for the Microsoft PowerPoint application. Whereas OpenDocument Presentation (ODP) is also a popular format that Apache OpenOffice supports and it contains a series of slides that may themselves contain text, images, media, and transition effects. So owing to the popularity of OpenOffice popularity, we are going to learn the steps on how to convert Microsoft PowerPoint (PPTX) to OpenDocument format using Python SDK.

MS PowerPoint Processing API

Aspose.Slides Cloud is capable of programmatically creating, editing, and transforming PowerPoint presentations to other supported formats including ODP. Now in order to implement the same capabilities in Python application, Aspose.Slides Cloud SDK for Python can be used (a wrapper around Cloud API). It is available for downloaded from PIP and GitHub. Please execute the following command on the command line terminal to install the SDK.

pip install asposeslidescloud

After the installation, you need to obtain your personalized ClientID and ClientSecret details. Therefore, the first step is to create an account by visiting Aspose.Cloud dashboard.

Convert Microsoft PowerPoint to ODP using Python

In the example given below, we are loading the Microsoft PowerPoint (PPTX file) from cloud storage and then saving the resultant ODP to the same cloud storage. Please follow the instructions given below to perform the conversion.

  • Create an object of the Configuration class
  • Initialize SlidesApi instance while passing Configuration object as an argument
  • Now call the method save_presentation(..) which takes name of input PPTX, output format value as ODP, output path information for resultant file and an optional parameter specifying slides to be converted.

Please download the sample files used in the above example from test-unprotected.pptx and ConvertedFile.odp.

Load PPTX from Local Drive

In this scenario, the input PPTX file is loaded from a local drive and converted to ODP format. Similar to the above scenario, the resultant file is saved on cloud storage.

  • First create an object of the Configuration class
  • Secondly, initialize SlidesApi instance while passing Configuration object as an argument
  • Now load the input PPTX to file object
  • Finally, call the method convert_and_save(..) and provide input PPTX, output format as ODP, output path detials. In this scenario, we are not providing any value for the optional parameter Slides, so all the slides are converted by default

PPTX File to ODP using cURL Command

Owing to REST architecture of Aspose.Slides Cloud, it can also be accessed through cURL commands. So we can also use Aspose.Slides API to convert PPTX file to ODP format using cURL command. However, first we need to generate a JWT access token based on your client credentials. Please execute the following command to generate the token.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now please execute the following command to load the PPT file from cloud storage and convert it to ODP format. Please note that the resultant ODP is also saved on cloud storage.

curl -v -X PUT "https://api.aspose.cloud/v3.0/slides/test-unprotected.ppt/Odp?outPath=ConvertedFile.odp" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: application/json" \
-d{}
MSPowerPoint preview

Image 1:- PPT to ODP conversion preview.

The sample PPT file used in the above example can be downloaded from test-unprotected.ppt and the resultant ODP from ConvertedFile-New.odp.

Conclusion

In this article, we have discussed the details on how we can convert Microsoft PowerPoint (PPTX) to OpenDocument format using Python code snippet. Similarly, we have also learned the steps to save msPowerpoint to ODP using the cURL command. The conversion of PPTX to PDF is also pretty simple. The complete source code of Python SDK is also available for download over GitHub. You may visit the Programmers Guide to learn more about other exciting features of the API.

Please visit the following links to learn more about: