我使用docx4j 2.8.1时遇到问题。 在VMWare Fusion windows xp中,我使用MS Office 2010创建一个docx word文件,插件为OpenDope。添加到文件2简单绑定并将此文件另存为docx。比我将这个文件复制到我原来的mac上的resource / templates / test.docx文件中,并在eclipse中尝试执行下一个代码:
InputStream template = getClass().getResourceAsStream("/templates/test.docx");
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(template);
并调用“load”方法导致以下异常:
org.docx4j.openpackaging.exceptions.Docx4JException: Error processing zip file (is it a zip file?)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:185)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:213)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:184)
at com.agiliumlabs.hr.server.ResumeConverter.getDocx(ResumeConverter.java:34)
at com.agiliumlabs.tests.TestResumeGenerate.main(TestResumeGenerate.java:22)
Caused by: java.util.zip.ZipException: oversubscribed dynamic bit lengths tree
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:154)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.docx4j.openpackaging.io.LoadFromZipNG.getBytesFromInputStream(LoadFromZipNG.java:121)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:178)
... 6 more
任何人都可以就这种情况提出建议吗?我使用Mac OS 1.7.4,jdk 1.6。