Unable to import apache.poi HSSFWorkbook
We are using Ensemble 2018.1.3.
I am trying to import the org.apache.poi jar file (I have same problem with 3.8, 4.0.1, and 4.1.2).
Whenever I try to import the org.apache.poi.hssf.usermodel.HSSFWorkbook class using the Java Gateway Wizard, I get an XML error such as the following:
ERROR #6301: SAX XML Parser Error: Line: 215 Offset: 20 invalid character 0x5 while processing /hs-connect/sys/mgr/Temp/mMQ5qDvObKsxaw.xml at line 215 offset 201In doing some digging, it looks like the problem is in the org.apache.poi.POIDocument.class because it has the following code in it:
protected void readProperties()
{
PropertySet ps = getPropertySet("\005DocumentSummaryInformation");
if ((ps != null) && ((ps instanceof DocumentSummaryInformation))) {
this.dsInf = ((DocumentSummaryInformation)ps);
} else if (ps != null) {
logger.log(POILogger.WARN, "DocumentSummaryInformation property set came back with wrong class - ", ps.getClass());
Has anyone gotten this to work? If I did a manual import would it work?
Thanks,
Tim
Comments
I advice against importing the entire library.
The best approach is to write your own simple java library and import that.
Here's my wrapper for Apache POI.
Also you can use Dynamic Gateway for Java. Does not require class generation at all.
Thank you for the reply.
We are not on IRIS yet so hopefully we will be able to do it then and we are not Java coders but need to use the POI in order to save to Excel files.
You can try this to create XLSX files from SQL queries (in the same project there's also XLS exporter).
Another option would be to export CSV and use LibreOffice to convert it to XLSX (among other formats). Here's how.