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 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.
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();
}
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.
Free Online Converter
Convert presentations and slides online.
Other Supported Conversions
You can also convert PowerPoint to files in other formats