Convert PPT to Word in Java

Render PowerPoint slides as images in a Word document using Java code without Microsoft PowerPoint or Office

Convert PowerPoint to Word in Java

Use this Java code to convert PPT to Word:

Java code for converting PowerPoint to Word

Presentation presentation = new Presentation("presentation.ppt");
try {
    Document document = new Document();
    DocumentBuilder documentBuilder = new DocumentBuilder(document);

    for (ISlide slide : presentation.getSlides()) {
        IImage slideImage = slide.getImage(1f, 1f);
        try {
            ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
            slideImage.save(imageStream, ImageFormat.Png);
            documentBuilder.insertImage(imageStream.toByteArray());
        } finally {
            slideImage.dispose();
        }

        documentBuilder.insertBreak(BreakType.PAGE_BREAK);
    }

    document.save("output.docx");
} finally {
    presentation.dispose();
}

Convert PowerPoint to Word using Aspose.Slides and Aspose.Words

Aspose.Slides for Java and Aspose.Words for Java let Java applications read PowerPoint presentations and create Word documents. The example renders each PPT slide as an image and inserts that image into a Document.

How to convert PPT to Word

  1. Install Aspose.Slides for Java and Aspose.Words for Java.
  2. Load the PPT presentation with the Presentation class.
  3. Create a Word Document and a DocumentBuilder.
  4. Render slide images with getImage and insert them with DocumentBuilder.
  5. Save the resulting Word document.

Built with Aspose.Slides

Convert PPT to Word Online

The free Aspose.Slides Conversion app is built with Aspose.Slides for Java, the same API as the code above. Open it and see what the API can do with your own PPT files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides converts files before you write code.
  • Upload PPT files and save them as Word.
  • Download the result or convert more files.

Other Supported Conversions

You can also convert PowerPoint to files in other formats