Cannot import XSSF in Apache POI

Mark Jackson picture Mark Jackson · May 4, 2011 · Viewed 184.1k times · Source

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

Answer

Pushkar picture Pushkar · May 4, 2011

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>