I am referencing the version 3.7 of the Apache POI and I am getting a "cannot be resolved" error when I do:
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
Other import statements that reference POI DO NOT give me errors, such as:
import org.apache.poi.ss.usermodel.*;
Any ideas??
After trying multiple things,what really worked was: 1. downloading "poi" and "poi-ooxml" manually 2.Adding these d/w jars into "Maven Dependencies"
The classes for the OOXML file formats (such as XSSF for .xlsx) are in a different Jar file. You need to include the poi-ooxml jar in your project, along with the dependencies for it
You can get a list of all the components and their dependencies on the POI website here.
What you probably want to do is download the 3.11 binary package, grab the
poi-ooxml
jar from it, and the dependencies in theooxml-lib
directory. Import these into your project and you'll be sorted.Alternately, if you use Maven, you can see here for the list of the artificats you'll want to depend on, but it'd want to be something like:
The poi-ooxml maven dependency will pull in the main POI jar and the dependencies for you automatically. If you want to work with the non-spreadsheet formats, you'd also want to depend on the
poi-scratchpad
artifact too, as detailed on the POI components pageI needed the following files for my implementation:
(though honestly, I'm not completely sure they are all necessary...) It's a little confusing because they are packaged that way. I needed to place them manually in my own "lib" folder and then add the references...
Maven always seems to download more than I need, so I always place libaries/dlls and things like that manually.
Problem: While importing the " org.apache.poi.xssf.usermodel.XSSFWorkbook"class showing an error in eclipse.
Solution: Use This maven dependency to resolve this problem:
-Hari Krishna Neela
For OOXML to work you need the POI-OOXML jar which is separately packaged from the POI jar.
Download the POI-OOXML jar from the following location -
http://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/3.11/poi-ooxml-3.11.jar
For Maven2 add the below dependency -
1) imported all the JARS from POI folder 2) Imported all the JARS from ooxml folder which a subdirectory of POI folder 3) Imported all the JARS from lib folder which is a subdirectory of POI folder