How to Export PowerPoint to Word using Java

This short tutorial describes how to export PowerPoint to Word using Java with the help of an easy to follow steps and a runnable sample code. You will convert PowerPoint to Word using Java by loading an existing presentation say PPTX or PPT and then transform it to an MS Word document like DOCX, DOC, or in any of the supported formats. There is no need to install MS PowerPoint, MS Word, or any other third-party tool to perform this conversion.

Steps to Export PowerPoint to Word using Java

  1. Configure the project to add Aspose.Slides for Java and Aspose.Words for Java from the repository
  2. Load an existing PowerPoint presentation that is to be converted to an MS Word document using the Presentation class object
  3. Save this presentation as an HTML file on the disk
  4. Create a LoadOptions class object using the Aspose.Words library
  5. Set the load format to HTML in the load options
  6. Load the previously saved HTML file into the Document class object in Aspose.Words library
  7. Save the document as DOCX on the disk

These steps assist in transforming the source presentation file from PowerPoint into Word using Java. The process is quite simple where a presentation is loaded and saved as an HTML file that is further loaded by the Aspose.Words library to convert it into the desired format. You will have complete control over the presentation loading, saving it as an HTML file, loading this HTML into the Document object, and then saving it as a Word file.

Code to Transform PPTX to DOCX using Java

This code demonstrates the process to convert PPTX to DOCX using Java where the Presentation class constructor is used with file name only however you may use other overloads also like the one with LoadOptions that supports setting fonts, load format, a password for the protected file, and warning callback to name a few. Similarly, once the HTML file is loaded into the document object, you can also perform a number of operations like setting background shape, page color, watermark, etc. before saving it as an MS Word document.

In this topic we learned to change a PPTX to DOCX using Java. However, if you want to create a fresh presentation and then save it as a Word file, refer to the article on how to create PowerPoint presentation using Java.

 English