Nick
Nick

Reputation: 85

Cannot implement xlsx file extension in apache POI

I cannot make an XSSF object in java with the apache POI. I have a list of file directories saved as an array of strings as "list[]". xls (HSSF) are working just fine with no errors.

Using the following code:

String s = list[i]; //line 205
InputStream input = new FileInputStream(s);  //line 206 
Workbook wb = new XSSFWorkbook(input); //line 207

I get the error:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions;
    at org.apache.poi.POIXMLDocumentPart.<clinit>(POIXMLDocumentPart.java:56)
    at FileTest.skim(FileTest.java:207)
    at FileTest.main(FileTest.java:125)

Upvotes: 0

Views: 1230

Answers (1)

Jonas Adler
Jonas Adler

Reputation: 913

This seems like a library mix-up. I just checked with xmlbeans-2.3.0 and it has the method you're missing. Make sure you have the proper dependencies for the POI version you're using.

Upvotes: 1

Related Questions