Java POI cannot find symbol WorkbookFactory

Doc Holiday picture Doc Holiday · Sep 10, 2012 · Viewed 33.8k times · Source

im doing a conversion of the HSSF model to XSSF. Im getting lil errors here and there. I donwloaded the latest POI and dropped all the jar files in and did the apache includes in my java class.....getting this error:

import org.apache.poi.ss.usermodel.Workbook;

Workbook wb = WorkbookFactory.create();

275: cannot find symbol [javac] symbol : variable WorkbookFactory [javac] location: class mil.usmc.logcom.chassis.util.HSSFUtils [javac] Workbook wb = WorkbookFactory.create();

Answer

brettjonesdev picture brettjonesdev · Jan 14, 2013

If the question you are asking is how do you find the WorkbookFactory class, that's a good question. WorkbookFactory apparently does not reside in the poi.jar - it is in the poi-ooxml jar.

Add this dependency to your maven project and you should be able to import WorkbookFactory:

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.9</version>
</dependency>