I'm trying to write a program that works with Excel docs, but the HSSF format is too small for my requirements. I'm attempting to move to XSSF, but I keep getting errors when trying to use it.
I managed to solve the first two by adding xmlbeans-2.3.0.jar and dom4j-1.6.jar to my program, but now this error is coming up, which doesn't seem to be resolved by adding the Apache commons jar available on the Apache website.
The error is as follows:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap at hot.memes.ExcelCreator.main(ExcelCreator.java:66) Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 1 more
XSSFWorkbook − This class has methods to read and write Microsoft Excel and OpenOffice xml files in . xls or . xlsx format. It is compatible with MS-Office versions 2007 or later.
Constructs a XSSFWorkbook object from a given file. Once you have finished working with the Workbook, you should close the package by calling close() , to avoid leaving file handles open.
Overview. HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (. xlsx) file format. HSSF and XSSF provides ways to read spreadsheets create, modify, read and write XLS spreadsheets.
The XSSF library implementation should be used for Excel . xlsx file format. The HSSF library and XSSF API provides mechanisms to read, write or modify excel spreadsheets. It also provides SXSSF that is an extension of XSSF to work with very large excel sheets.
Add commons-collections4-x.x.jar file in your build path and try it again. It will work.
You can download it from https://mvnrepository.com/artifact/org.apache.commons/commons-collections4/4.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With