在调用2003的时候新建一个word可以插入图片,但在调用2007的时候出现如下出错
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(JavaBeansLauncher.java:79)
Caused by: com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Documents
Description: An unknown COM error has occured.
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:384)
at com.jacob.com.Dispatch.get(Dispatch.java:512)
at com.mocha.test.WordBean.createNewDocument(WordTest.java:37)
at com.mocha.test.WordTest.readfile(WordTest.java:279)
at com.mocha.test.WordTest.main(WordTest.java:309)
... 5 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(JavaBeansLauncher.java:79)
Caused by: com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Documents
Description: An unknown COM error has occured.
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:384)
at com.jacob.com.Dispatch.get(Dispatch.java:512)
at com.mocha.test.WordBean.createNewDocument(WordTest.java:37)
at com.mocha.test.WordTest.readfile(WordTest.java:279)
at com.mocha.test.WordTest.main(WordTest.java:309)
... 5 more
内容,文本、图片、表格等一应俱全,更令人激动的是同时支持word2003、2007、2010、2013。而POI处理doc
和docx的完全是两组不兼容的对象,而poi解析.doc那部分组件是残缺不全的并且也已经不更新了