Forum Discussion
This is the code I used in SoapUI:
def filePath = "C:/Work/Data/Sasktel/Commercail Wireless/1. Internal Flags/OR/OR-ICT00345.xlsx"
FileInputStream inputStream = new FileInputStream(new File(filePath));
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
rowNumInt = rowNumInt + 1
Row row = sheet.createRow(rowNumInt);
Cell cell = row.createCell(25);
cell.setCellValue(result);
inputStream.close();
FileOutputStream outputStream = new FileOutputStream(filePath);
workbook.write(outputStream);
workbook.close();
outputStream.close();
This is the exception I get:
ERROR:java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
Do you have a solution to fix this?
Thanks
firstly, to ensure you import required package, as follows:
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
secondly, you'd better to use try...catch for any I/O operation, as like
try { FileOutputStream outputStream = new FileOutputStream(FILE_NAME) workbook.write(outputStream) workbook.close() } catch (FileNotFoundException e) { e.printStackTrace() } catch (IOException e) { e.printStackTrace() }
- Olga_T6 years agoSmartBear Alumni (Retired)
Hi all,
aaronpliu, HimanshuTayal, thank you for your time looking into this!
Jason1, did you manage to accomplish your task? If your question was answered, don't hesitate to mark the reply that helped you as a solution to this topic. You can do this by clicking the Accept as Solution button below the appropriate reply.
We are looking forward to hearing from you.
Related Content
- 8 months agoEgg