I get the following error when trying to read a PPT file.
java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I)Ljava/lang/Integer; at com.aspose.slides.Table.getRowsNumber(SourceFile:214) at com.aspose.slides.Table.(SourceFile:122) at com.aspose.slides.Slide.(SourceFile:188) at com.aspose.slides.Presentation.if(SourceFile:330) at com.aspose.slides.Presentation.(SourceFile:455) at com.la.utility.ppt.MSPowerPointReader.main(MSPowerPointReader.java:36) Exception in thread "main"
Thank you for your help. Is that the same version that is bundled with Aspose.Total. I looked up the Sun documentation and the error that I am getting is because I am using jdk 142 and Integer.valueOf(int) is introduced with jdk5.0.
I will try it with JDK 5.0
Please let me know if I am in the right direction.
Thank you. I ran the code with jdk 5.0 and it worked. Now I have another problem. I am trying to read the attached PPT and it returns the placeholders as null.
Below is the code I am using to read this slide.
try { MSPowerPointReader mspowerpointreader = new MSPowerPointReader(); FileInputStream fIS = new FileInputStream(new File("C:\\Projects\\MSOfficeParser\\A.PPT")); Presentation pres = new Presentation(fIS); Slides slides = pres.getSlides(); int size = slides.size(); System.out.println("Size "+size);
First you should use the Slide.getSlidePosition method to get normal slide. You should not get them from Presentation.Slides collection. The slide position always start from 1
Slide.Placeholders collection contains 8 hardcoded Placeholder objects. The first placeholder object at index 0 is for title and so on.
I am sorry I am not following. I get the slide from the Slides collection. I iterate through them and get all the placeholders using method Slide.getPlaceHolders() which in my case is returning null for each element in the collection.
Let me know if I am missing something or if you have some sample code that I could use.
int numSlides = pres.getSlides().getLastSlidePosition();
for (int i = 1; i <= numSlides; i++) {
Slide singleSlide = pres.getSlideByPosition(i);
processSlide(singleSlide);
// ...
}
FYI: Presentation.getSlides() collection also contains title masters along with normal slides, for this reason, Aspose.Slides provide the method Presentation.getSlideByPosition to retrieve normal slides by their position in presentation.
I have checked your presentation A1.ppt, it contains a single slide which does not have any placeholder. Instead, it has one TextFrame and one table object
You can see it by iterating through all shapes and checking the return value of Shape.isTextHolder() method. If it returns true, then the shape is a placeholder containing text which can be converted to textholder, otherwise it is a non-placeholder.
The difference between TextHolder and TextFrame is that TextHolder is a Placeholder having text while TextFrame is a TextBox in MS PowerPoint.
You cannot create Placeholders (Textholders); they are shipped with MS-PowerPoint as Slide Lay Outs
However you can create as many Text Boxes (Text Frames) as you want on a slide.