m0_37642519
m0_37642519
采纳率0%
2018-12-01 08:17

Docx4j操作word时,Couldn't get [Content_Types].xml from ZipFile?

代码如下所示:
String srcPath = "D:\upload\docx001.docx";
InputStream inputStream = new FileInputStream(srcPath);
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(inputStream);
在执行到load行代码时,会报错
错误信息如下

            Exception in thread "main" org.docx4j.openpackaging.exceptions.Docx4JException: Couldn't get [Content_Types].xml from ZipFile
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:148)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:523)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:379)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:345)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:310)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:184)
at com.aspose.words.examples.docx4j.Docx4jWord.relpaceBookmark(Docx4jWord.java:36)
at com.aspose.words.examples.docx4j.Docx4jWord.main(Docx4jWord.java:24)

Caused by: org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:771)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:146)
... 7 more
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:737)
... 8 more
希望可以得到大家帮助,解决这个问题

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • qq_41190713 litt-t 2月前

    解决了吗

     

    点赞 评论 复制链接分享

相关推荐