error: package org.apache.poi.ss.usermodel does not exist

0
Hello, I’m trying to do my first Java action: It is a basic code creating an Excel Workbook and save it on the diskBut when I compile it, I have a lot of errors saying that the org.apache.poi.ss.usermodel packages do not exist… I saw that these packages are used in the module xlsreport so it should be possible…. Could you tell me why and how can I solve it? Thanks in advance my code: // This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package advanced_excel.actions; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; public class Workbook_Create extends CustomJavaAction<java.lang.Void> { public Workbook_Create(IContext context) { super(context); } @java.lang.Override public java.lang.Void executeAction() throws Exception { // BEGIN USER CODE XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet("Java Books"); Object[][] bookData = { {"Head First Java", "Kathy Serria", 79}, {"Effective Java", "Joshua Bloch", 36}, {"Clean Code", "Robert martin", 42}, {"Thinking in Java", "Bruce Eckel", 35}, }; int rowCount = 0; for (Object[] aBook : bookData) { Row row = sheet.createRow(++rowCount); int columnCount = 0; for (Object field : aBook) { Cell cell = row.createCell(++columnCount); if (field instanceof String) { cell.setCellValue((String) field); } else if (field instanceof Integer) { cell.setCellValue((Integer) field); } } } try (FileOutputStream outputStream = new FileOutputStream("E:\\Temp\\JavaBooks.xlsx")) { workbook.write(outputStream); } // END USER CODE } /** * Returns a string representation of this action */ @java.lang.Override public java.lang.String toString() { return "Workbook_Create"; } // BEGIN EXTRA CODE // END EXTRA CODE }   Vincent
asked
2 answers
1

Yes, rather self explanatory.. xmlbeans-3.0.1 is a required library for the Excel module also so probably there's a dependecy on that library in one of the poi classes..

So on to the next library to add to your userlib!

answered
1

Do you have the required libraries in your \{project}\userlib folder? If not, place them there. 

answered