I want to create an .xlsx workbook. Following instructions from tutorials and other Stackoverflow questions such as the following
Cannot import XSSF in Apache POI
I added the following dependency :
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
My piece of code to convert a multipart file to xlsx workbook is the following:
public void readExcelWorkbook(EuropeanAwards euApp, MultipartFile file) throws IllegalStateException, IOException
{
File excelFile = new File(file.getOriginalFilename());
file.transferTo(excelFile);
FileInputStream fIP = new FileInputStream(excelFile);
XSSFWorkbook workbook = new XSSFWorkbook(fIP);
}
The following import:
import org.apache.poi.xssf.usermodel.*;
is not recognized. I tried to add the poi-ooxml-schemas depencency instead but the import is still not recognized. Note that the hssf files are correctly recognized when adding the corresponding import:
import org.apache.poi.hssf.usermodel.*;
Any ideas ?