× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.





Strangely, the 'open' returns an address of ZERO for 'book' but does not
halt. The exception occurs only when the HSSF_GETSHEET fails because the
'book' address is 0.

That's not strange at all. In an earlier discussion someone (I thought it was you, actually?) was trying to handle situations where hssf_open() could fail. I think he was trying to open a file that might not exist, and wanted a way to handle the error properly. My memory is fuzzy, but it was something like that.

Hang on, I'll look up the message in the archives... yes, it was you. Here are the key messages in the thread where we discussed it.
http://archive.midrange.com/rpg400-l/200608/msg00733.html
http://archive.midrange.com/rpg400-l/200608/msg00745.html

I probably didn't tell you that I changed it, though.. my fault. The idea, though, is that instead of crashing (and taking the JVM down) when a file can't be opened for some reason, it now returns *NULL. Your program and therefore check for that.

     if HSSF_open( '/path/to/myfile.xls' ) = *NULL;
          ErrMsg ='Unable to open Excel document';
          ShowErrorToUser(Errmsg);
          iter;  // try next document.
     endif;

The following part of your message is the REAL problem, the reason why it's failing and therefore returning zero:

  received Java exception
"org.apache.poi.hssf.record.RecordFormatException:
  Unable to construct record instance, the following" when calling method
  "<init>" with signature
  "(Lorg.apache.poi.poifs.filesystem.POIFSFileSystem;)V" in class
  "org.apache.poi.hssf.usermodel.HSSFWorkbook".

Excel documents are made up of specially formatted "records" (they aren't database records in the manner that we're used to thinking of, but they are a record of sorts.)

When the Java code (HSSF) is reading the file, it needs to create a new Java record object to handle the record that it just loaded from the Excel document. However, for some reason it's unable to do that.

I would suspect that either it doesn't understand the format of the record (maybe it's a feature that HSSF doesn't support) or there's a bug in the Apache HSSF code. Something like that.

Unfortunately, that's outside of my area of expertise. You could try upgrading POI to see if it's fixed in a newer version, or you might try searching (Google) for the Java error to see if anyone else has encountered it and found a workaround.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.