Parse ODP Formats in Java
Native and high performance ODP document parsing using server-side Aspose.Slides for Java APIs, without the use of any software like Microsoft or Adobe PDF.
Parse ODP File Using Java
In order to parse ODP file, we’ll use
API which is a feature-rich, powerful and easy to use parsing API for Java platform. You can download its latest version directly from
and install it within your Maven-based project by adding the following configurations to the pom.xml.
Repository
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://releases.aspose.com/java/repo/</url>
</repository>
Dependency
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>version of aspose-slides API</version>
<classifier>jdk17</classifier>
</dependency>
How to Parse ODP Files in Java
A basic document parsing with Aspose.Slides for Java APIs can be done with just few lines of code.
Load ODP file by instatiating Presentation class.
Get first slide text frames.
Loop through each paragraph portion.
Get the required output like text, font etc.
System Requirements
Aspose.Slides for Java supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
- Get latest version of Aspose.Slides for Java directly from Maven .
Parse ODP Files - Java
//Load ODP file
Presentation odpPresentation = new Presentation("demo.odp");
try{
//Get an Array of TextFrameEx objects from the first slide
ITextFrame[] textFramesSlideOne = SlideUtil.getAllTextBoxes(odpPresentation.getSlides().get_Item(0));
//Loop through the Array of TextFrames
for (int i = 0; i < textFramesSlideOne.length; i++){
//Loop through paragraphs in current TextFrame
for (IParagraph para : textFramesSlideOne[0].getParagraphs()){
//Loop through portions in the current Paragraph
for (IPortion port : para.getPortions()){
//Display text in the current portion
System.out.print(port.getText());
//Display font height of the text
System.out.print(port.getPortionFormat().getFontHeight());
//Display font name of the text
System.out.print(port.getPortionFormat().getLatinFont().getFontName());
}
}
}
} finally {
if (odpPresentation != null) odpPresentation.dispose();
}
//Similarly extarcting text from the Whole Presentation
//Use getAllTextFrames(odpPresentation, true) method and Iterate through Array
About Aspose.Slides for Java API
Aspose.Slides API can be used to read, write, manipulate and convert Microsoft PowerPoint documents to PDF, XPS, HTML, TIFF, ODP and various other formats. One can create new files from scratch and save those in the relevant supported formats. Aspose.Slides is a standalone API for creating, parsing or manipulating presentations, slides and elements and it does not depend on any software like Microsoft or OpenOffice.Online ODP Parser Live Demos
ODP What is ODP File Format?
Files with ODP extension represent presentation file format used by OpenOffice.org in the OASISOpen standard. A presentation file is a collection of slides where each slide can comprise of text, images, formatting, animations, and other media. These slides are presented to audience in the form of slideshows with custom presentation settings. ODP files can be opened by applications that conform to the OpenDocument format (such as OpenOffice or StarOffice).
Read More