Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache POI 3.9 : WorkbookFactory method not found

Tags:

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?

like image 235
Gunjan Shah Avatar asked Dec 28 '12 10:12

Gunjan Shah


People also ask

Can Apache POI be compiled used with Java 11?

Including the existing binaries on Java 11 as normal jar-files should work when using recent versions of Apache POI.

What is Apache POI ooxml?

Apache POI provides Java API for manipulating various file formats based on the Office Open XML (OOXML) standard and OLE2 standard from Microsoft. Apache POI releases are available under the Apache License (V2. 0).

How do I know what version of Apache POI I have?

To verify this, execute any of the two commands depending on the platform you are working on. If the Java installation has been done properly, then it will display the current version and specification of your Java installation.

Why did u choose Apache POI over others to read data from Excel explain its advantages?

Apache POI have different classes and method to work upon different MS Office Document. It's Stand for “Poor Obfuscation Implementation File System”. This component is the basic factor of all other POI elements. It is used to read different files explicitly.


2 Answers

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!

like image 121
Gagravarr Avatar answered Oct 01 '22 20:10

Gagravarr


I would be surprised that they made such breaking change without mentioning it in the list of changes...

And indeed, I can see the WorkbookFactory in the JavaDoc, which I suppose are up-to-date with the latest version.

Perhaps you can show some simple code that worked in 3.8 and no longer works in 3.9, along with the error message(s) you get. The problem might not be what you think...

like image 38
PhiLho Avatar answered Oct 01 '22 22:10

PhiLho