Apache POI 3.9 : WorkbookFactory method not found

你说的曾经没有我的故事 提交于 2019-12-30 05:47:03

问题


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?


回答1:


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!




回答2:


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...



来源:https://stackoverflow.com/questions/14067983/apache-poi-3-9-workbookfactory-method-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!