上贴中有位大虾提出如下解决方法:
把POI的三个JAR加到项目库,注意下载的时候要选2006年6月16日的版本:
http://mirror.vmmatrix.net/apache/jakarta/poi/dev/bin/
下边是一个非常简单的调用例子,其他功能楼主慢慢挖掘吧,有完善的文档可以参考的。package test;import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.Shape;
import org.apache.poi.hslf.model.TextBox;
import org.apache.poi.hslf.usermodel.SlideShow;public class TestPOI {/**
 * @param args
 */
public static void main(String[] args) 
{
try
{
SlideShow ss = new SlideShow(new HSLFSlideShow("C:\\测试.ppt"));org.apache.poi.hslf.model.Slide[] slides = ss.getSlides();Shape[] sps = slides[0].getShapes();System.out.println(((TextBox)sps[0]).getText());}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
}
但是运行得时候报错:
java.lang.RuntimeException: Couldn't instantiate the class for type with id 1016 on class class org.apache.poi.hslf.record.DummyPositionSensitiveRecordWithChildren : java.lang.reflect.InvocationTargetException
Cause was : java.lang.RuntimeException: Couldn't instantiate the class for type with id 1036 on class class org.apache.poi.hslf.record.PPDrawing : java.lang.reflect.InvocationTargetException
Cause was : java.lang.NegativeArraySizeException

解决方案 »

  1.   

    是不是 PPT 的版本问题?
      

  2.   

    例子没有问题呀,是否在你的CLASSPATH路径里面有两个PPDrawing 或 DummyPositionSensitiveRecordWithChildren ,程序使用了旧版本的类
      

  3.   

    如何在Java内嵌入PPT
    http://blog.csdn.net/bovy/archive/2007/04/06/1554922.aspx
    把Word/Excel/Power Point嵌入到Java程序内
    http://blog.csdn.net/bovy/archive/2007/04/06/1554447.aspx