1

我在使用 docx4j 2.8.1 时遇到问题。在 VMWare Fusion windows xp 中,我使用 MS Office 2010 和插件 OpenDope 创建了一个 docx word 文件。将 2 个简单绑定添加到文件中,并将此文件另存为 docx。比我把这个文件复制到我原来的mac上的resource/templates/test.docx文件,然后在eclipse中尝试执行下一个代码:

InputStream template = getClass().getResourceAsStream("/templates/test.docx");
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(template);

并调用“加载”方法会导致以下异常:

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。

4

0 回答 0