Convert PPT to Word in Java

Convert PowerPoint slides to a Word document using Java code without Microsoft PowerPoint or Office

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. A PPT to Word workflow usually renders each slide image, extracts slide text, and writes that content into a Document.

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();
}

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 write slide text with DocumentBuilder.

  5. Save the resulting Word document.

Free Online Converter

Convert presentations and slides online.

Other Supported Conversions

You can also convert PowerPoint to files in other formats