Sophonias
Sophonias

Reputation: 914

Having trouble implementing Apache POI; I have the right dependencies but imports don't seem to work

I have been trying to implement Apache POI to export Excel files from a Spring 3.0 web app. I tried using many different versions of its dependencies (from 3.2 to 3.8_beta5 version) but it turns out my controller can't recognize the imports in the "org.apache.poi.ss.usermodel".

Is there something I am missing? I am very new to this exporting stuff so I am willing to take any suggestions. I would even consider using a completely different API.

Here is the dependency I currently have

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.6</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

the missing classes are

 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 

Upvotes: 1

Views: 1097

Answers (1)

Gagravarr
Gagravarr

Reputation: 48366

You should have a read of the Overview and Components page on the POI website, that tells you which dependencies and/or maven artifacts you need.

If you look there, you'll see that for XSSF, you need to include the poi-ooxml artifact as well as the core poi one (Maven will then pull down all the other dependencies for you)

Additionally, POI 3.6 is just over 2 years old, and there have been a lot of bug fixes since then. You'll likely want to use POI 3.8 beta 5, and then upgrade to POI 3.8 final in a few weeks time.

Upvotes: 1

Related Questions