Unable to use XSSF with Excel 2007

Posted by Tarun on Stack Overflow See other posts from Stack Overflow or by Tarun
Published on 2010-06-13T07:35:23Z Indexed on 2010/06/13 7:42 UTC
Read the original article Hit count: 744

Filed under:
|

Hello All,

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 -

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.POIXMLDocumentPart.(POIXMLDocumentPart.java:46)

This is my piece of code -

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-schemas-3.6 x-bean.jar

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

© Stack Overflow or respective owner

Related posts about java

Related posts about apache-poi