Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 1.50 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to get the Slide number using java via Apache POI API
  2. public final class count {
  3.  
  4.   public static void main(String args[]) throws Exception {
  5.  
  6.     File file= new File("C:/Users/THIYAGARAJAN/Desktop/ppt52.ppt");
  7.     FileInputStream is = new FileInputStream(file);
  8.     SlideShow ppt = new SlideShow(is);
  9.     is.close();
  10.     Slide[] slide = ppt.getSlides();
  11.     System.out.println(slide.length);
  12.     for (int i = 0; i < slide.length; i++)  {
  13.       String title = slide[i].getTitle();
  14.       System.out.println("Rendering slide "
  15.                          + slide[i].getSlideNumber()
  16.                          + (title == null ? "" : ": " + title));
  17.     }
  18.   }
  19.  
  20. }
  21.        
  22. Exception in thread "main" java.lang.NoSuchFieldError: filesystem
  23. at org.apache.poi.hslf.HSLFSlideShow.getPOIFSFileSystem(HSLFSlideShow.java:79)
  24. at org.apache.poi.hslf.EncryptedSlideShow.checkIfEncrypted(EncryptedSlideShow.java:‌​51)
  25. at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:141)
  26. at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:115)
  27. at org.apache.poi.hslf.HSLFSlideShow.<init>(HSLFSlideShow.java:103)
  28. at org.apache.poi.hslf.usermodel.SlideShow.<init>(SlideShow.java:121)
  29. at count.count.main(count.java:22)
  30.        
  31. ClassLoader classloader =
  32.          org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
  33. URL res = classloader.getResource(
  34.          "org/apache/poi/poifs/filesystem/POIFSFileSystem.class");
  35. String path = res.getPath();
  36. System.out.println("Core POI came from " + path);
  37.        
  38. int getSlideCount()