报错信息如下:
Request processing failed; nested exception is org. apache poi poifs filesystem OfficeXmlFile Exception: The supplied data appears to be in the Office 2007+ XML. You are calling the part
of Poi that deals with OLE2 Office Documents. You need to call a different part of poi to process this data(eg XSSF instead of HSSF)
描述服务器遇到一个意外的情况,阻止它完成请求
Exception
org. springframework. web. util. NestedServletException: Request processing failed; nested exception is org. apache poi. poifs filesystem OfficeXmlFileException: The supplied data appears to
be in the office 2007+ XML. You are calling the part of poi that deals with OLE2 Office Documents. You need to call a different part of poi to process this data(eg Xss instead of HSSF
processReque
ework Servlet java: 973)
org. springframework. web. servlet Framework Servlet doPost(FrameworkServlet java: 863)
ax.servlet.httphttpServletservice(htt
let java: 660)
org. springframework. web. servlet Framework Servlet. service(FrameworkServlet java: 837)
org. apache tomcat websocket server. WsFilter do Filter(WsFilter, java: 53)
com. thetransactioncompany cors CORSFilter doFilter( CORSFilter,java: 195)
com. thetransactioncompany cors CORS Filter do Filter(CORSFilter java: 266)
org. apache poi. poifs filesystem OfficeXmlFile Exception: The supplied data appears to be in the Office 2007+ XML. You are calling the part of poi that deals with OLE2 Office Documents. You
need to call a different part of POi to process this data(eg XSSF instead of HSSF)
org. apache poi. poifs storage Header Block. <init>(Header Block java: 130)
org. apache poi. poifs storage Header Block. <init>(Header Block. java: 117)
org. apache poi. poifs. filesystem. POIFSFile System <init>(POIFSFile System java: 294)
org. apache poi hssf. usermodel HSSFWorkbook <init>(HSSFWorkbook, java: 382)
cn.cqsoft commons utils. ReadExcelUtil getWork Book(Read ExcelUtil java: 131)
谢谢大家了,问题找到了,我上传文件格式是xls格式,我后台有段死编码:读取文件是xlsx格式,因此报错!
You need to call a different part of poi to process this data(eg XSSF instead of HSSF)
试试看呀
判断excel是.xls还是 .xlsx结尾 这个 是有区别的。用的api 不同的
你用的什么dll,两个系统的dll不一样吧
系统之间配置文件问题
使用aspose.excel插件。兼容 linux;
谢谢大家回复,我是判断了的
– River111 5年前通过这个方法创建Workbook实例,这个方法是处理了xls,xlsx文件(即调用不同的api创建不相应文件的实例对象)
但是结果是:linux上导入数据就是报错(有日期数据的情况下).
/**
– River111 5年前判断excel的版本,并根据文件流数据获取workbook
@throws IOException
/
public static Workbook getWorkBook(InputStream is,File file) throws Exception{