有即懂Java又懂Cognos8的进来帮个忙,我用Javapoi读取由Cognos8生成的Excel00、02、07的三种文件都报错!
00、02的必须另存一下才行,若不另存就抱错00报错:java.io.IOException:Invalidheadersignature;read0x7820206C6...
00、02的必须另存一下才行,若不另存就抱错
00报错: java.io.IOException: Invalid header signature; read 0x7820206C6D74683C, expected 0xE11AB1A1E011CFD0
02报错: java.io.IOException: Invalid header signature; read 0x7265562D454D494D, expected 0xE11AB1A1E011CFD0
07报错: 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 XSSF instead of HSSF)
我用的poi一个是3.2的一个是3.6的都不行,那位大侠能帮一把,在下不胜感激!
拜谢!
我是用HSSFWorkbook读取的,在这一行报错,HSSFWorkbook workbook = new HSSFWorkbook(file.getInputStream());
有位前辈用的是poi3.0.1,里边有个WorkbookFactory,可以通过WorkbookFactory.createWorkbook生成,据说能读Excel4.0,不知道和我这个有没有关系。
顺便问一句,啥叫Excel4.0啊???
我的前几行代码:(出异常,无法往下执行,所以就提供下面的代码了)
FormFile file = new DiskFile(path);
if(file == null)
{
return "<h3 align='center'>文件读取失败!</h3>";
}
HSSFWorkbook workbook = new HSSFWorkbook(file.getInputStream());
HSSFSheet sheet = workbook.getSheetAt(0);
path是Excel文件的路径,不是XML文件 展开
00报错: java.io.IOException: Invalid header signature; read 0x7820206C6D74683C, expected 0xE11AB1A1E011CFD0
02报错: java.io.IOException: Invalid header signature; read 0x7265562D454D494D, expected 0xE11AB1A1E011CFD0
07报错: 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 XSSF instead of HSSF)
我用的poi一个是3.2的一个是3.6的都不行,那位大侠能帮一把,在下不胜感激!
拜谢!
我是用HSSFWorkbook读取的,在这一行报错,HSSFWorkbook workbook = new HSSFWorkbook(file.getInputStream());
有位前辈用的是poi3.0.1,里边有个WorkbookFactory,可以通过WorkbookFactory.createWorkbook生成,据说能读Excel4.0,不知道和我这个有没有关系。
顺便问一句,啥叫Excel4.0啊???
我的前几行代码:(出异常,无法往下执行,所以就提供下面的代码了)
FormFile file = new DiskFile(path);
if(file == null)
{
return "<h3 align='center'>文件读取失败!</h3>";
}
HSSFWorkbook workbook = new HSSFWorkbook(file.getInputStream());
HSSFSheet sheet = workbook.getSheetAt(0);
path是Excel文件的路径,不是XML文件 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询