无法使用XSSF与Excel 2007 [英] Unable to use XSSF with Excel 2007

查看:237
本文介绍了无法使用XSSF与Excel 2007的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有艰难的时间去读取Excel 2007中我使用XSSF读取Excel中的一个特定的单元格数据,但不断收到数据错误 -

I am having tough time getting to read data from excel 2007. I am using XSSF to read data from a specific cell of excel but keep getting error -


异常线程mainjava.lang.NoSuchMethodError:org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg /阿帕奇/的XMLBeans / XmlOptions;
    在org.apache.poi.POIXMLDocumentPart(POIXMLDocumentPart.java:46)

这是我的作品code的 -

This is my piece of code -


公共静态无效的主要(字串[] args)抛出IOException异常{

public static void main(String [] args) throws IOException {

    InputStream ins = new FileInputStream("C:\\Users\\Tarun3Kumar\\Desktop\\test.xlsx"); 


    XSSFWorkbook xwb = new XSSFWorkbook(ins);
    XSSFSheet sheet = xwb.getSheetAt(0);
    Row row = sheet.getRow(1);
    Cell cell = row.getCell(0);
    System.out.println(cell.getStringCellValue());
    System.out.println("a");
}

我已经加入以下罐子到构建路径 -

I have following jars added to build path -

POI-3.6
POI-OOXML-3.6
POI-OOXML-架构 - 3.6
的X bean.jar

poi-3.6 poi-ooxml-3.6 poi-ooxml-schemas-3.6 x-bean.jar

我只能弄清楚,setSaveAggressiveNamespaces已取代setSaveAggresiveNamespaces......

I could only figure out that "setSaveAggressiveNamespaces" has replaced "setSaveAggresiveNamespaces"....

推荐答案

还有其他的问题,恰巧是:xbean.jar和xmlbeans.jar都有XmlOptions,但只有xmlbeans.jar有你想要的方式。我改变路径为了xmlbeans.jar第一和工作。

there is other issue happen to be: xbean.jar and xmlbeans.jar both have XmlOptions, but only xmlbeans.jar have method you want. I changed path order for xmlbeans.jar first and worked.

这篇关于无法使用XSSF与Excel 2007的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆