07 版本可以导入 03 导入报错

来源:2-8 导入Word

慕桂英5446361

2017-12-21 18:19:53

按照老师的步骤  03可以导入,接着 处理07版本  就会导致07版本可以导入成功,再导入03就报错了。  运行老师的代码也是存在同样的问题 03不能导入了。

异常信息如下:

HTTP Status 500 – Internal Server Error
Type Exception Report
Message The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.poi.openxml4j.exceptions.OLE2NotOfficeXmlFileException: The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
	org.apache.poi.openxml4j.opc.internal.ZipHelper.verifyZipHeader(ZipHelper.java:184)
	org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:241)
	org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:98)
	org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
	org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
	org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:116)
	org.imooc.service.WordService.imp(WordService.java:46)
	org.imooc.servlet.ImportWordServlet.doPost(ImportWordServlet.java:34)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/8.0.0





写回答

1回答

好帮手慕珊

2017-12-21

确认一下03和07版本的word文档都是通过office的word进行创建并保存为.doc或.docx格式,而不是直接通过改后缀名的方式完成的。老师的代码我们之前都运行过,是可以导入的。

祝学习愉快!

0

0 学习 · 1363 问题

查看课程