
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 1.50 KB | hits: 25 | expires: Never
How to get the Slide number using java via Apache POI API
public final class count {
public static void main(String args[]) throws Exception {
File file= new File("C:/Users/THIYAGARAJAN/Desktop/ppt52.ppt");
FileInputStream is = new FileInputStream(file);
SlideShow ppt = new SlideShow(is);
is.close();
Slide[] slide = ppt.getSlides();
System.out.println(slide.length);
for (int i = 0; i < slide.length; i++) {
String title = slide[i].getTitle();
System.out.println("Rendering slide "
+ slide[i].getSlideNumber()
+ (title == null ? "" : ": " + title));
}
}
}
Exception in thread "main" java.lang.NoSuchFieldError: filesystem
at org.apache.poi.hslf.HSLFSlideShow.getPOIFSFileSystem(HSLFSlideShow.java:79)
at org.apache.poi.hslf.EncryptedSlideShow.checkIfEncrypted(EncryptedSlideShow.java:51)
at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:141)
at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:115)
at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:103)
at org.apache.poi.hslf.usermodel.SlideShow.<init>(SlideShow.java:121)
at count.count.main(count.java:22)
ClassLoader classloader =
org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
URL res = classloader.getResource(
"org/apache/poi/poifs/filesystem/POIFSFileSystem.class");
String path = res.getPath();
System.out.println("Core POI came from " + path);
int getSlideCount()