Apache POI 3.9 : WorkbookFactory method not found

Gunjan Shah picture Gunjan Shah · Dec 28, 2012 · Viewed 30.9k times · Source

In my app I have used Apache POI 3.8 for XLS file processing.

Now I want to migrate to Apache POI 3.9 latest and stable version. I have added the JAR file poi-3.9-20121203.jar in my application and removed JARs related to POI 3.8.

But it seems that, in 3.9 version, the WorkbookFactory class has been removed.

So how can I create a Workbook with WorkbookFactory in Apache POI 3.9 ?

I extracted the JAR and checked, there is no class like WorkbookFactory.

Can anyone tell me how to create a new workbook with POI 3.9?

Answer

Gagravarr picture Gagravarr · Dec 28, 2012

You're missing several JARs. Take a look at the POI Components Page and you'll see that you need the POI-3.9 jar, the POI-OOXML-3.9 jar, and their respective dependencies.

If you want to work with any of the other formats (eg doc, docx, ppt, pptx) you'll also need the POI-Scratchpad-3.9 jar. As you're working with the OOXML file formats (eg .xlsx), as shown in the components page, you'll need either the POI-OOXML_Schemas-3.9 jar, or the larger full OOXML-Schemas-1.1 jar.

Also, since this question was asked, there have been two new releases of Apache POI, with lots of bugs fixed and new features added, so it's worth using the latest version (3.11 as of writing) rather than 3.9!