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 -
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
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 the ooxml-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:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
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 page
I added below contents in app "build.gradle"
implementation 'org.apache.poi:poi:4.0.0'
implementation 'org.apache.poi:poi-ooxml:4.0.0'
If you use Maven:
poi => poi-ooxml in artifactId
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
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:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
-Hari Krishna Neela
I Got the Solution Guys
You need to keep some points in your mind .
There are two different dependency one is (poi) & other dependency is (poi- ooxml) but make sure you must use poi-ooxml dependency in your code.
Just Add the following dependency in pom.xml & Save it.
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
3 .After you have saved the pom.xml then you need to try a small thing ,Use (.) operator will try to import/fetch it & finally will not see any sort of error because now it has imported that thing in your package.
Sample Code to Understand Better !!
package ReadFile;// package
import org.apache.poi.xssf.usermodel.XSSFWorkbook; // automatically added to your code after importing
public class Test
{
public static void Hello() // Method
{
XSSFWorkbook workbook = new XSSFWorkbook();
}
}
I tried my best to give you the solution , If you face any issue comment here i will try
to solve it .
Keep Learning Guys !!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With