Convert PPTX to Word in Java
Convert PowerPoint slides to a Word document using Java code without Microsoft PowerPoint or Office
Convert PowerPoint to Word in Java
Use this Java code to convert PPTX to Word:
Java code for converting PowerPoint to Word
Presentation presentation = new Presentation("presentation.pptx");
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. A PPTX to Word workflow can render each slide as an image and insert the images into a Document.
How to convert PPTX to Word
- Install
Aspose.Slides for JavaandAspose.Words for Java. - Load the
PPTXpresentation with thePresentationclass. - Create a Word
Documentand aDocumentBuilder. - Render each slide with
getImageand insert the image into the Word document. - Save the resulting Word document.
Built with Aspose.Slides
Convert PPTX 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 PPTX files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides converts files before you write code.
- Upload PPTX 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