On Jul 7, 2011, at 12:42 PM, Eric B. wrote: > On 07/07/2011 02:14 PM, Eric B. wrote: >> On 07/07/2011 01:56 PM, Nick Burch wrote: >>> On Thu, 7 Jul 2011, Eric B. wrote: >>>> Is this a POI error, or a file structure error? If the later, is there >>>> any way to tell POI to ignore a LeftOverDataException? >>> >>> This error is telling you that an assumption POI has made about the >>> structure of one of the records has turned out incorrect >>> >>> The fix is to look at the excel file format specs, and compare the POI >>> record code and the file to them. If POI is wrong, POI needs fixing. >>> (This will typically happen when we don't check for an extension flag or >>> similar). If the file isn't spec compliant, then we need to decide if >>> it's salvagable or not, and put in a workaround if possible >> >> >> I am nearly certain that the file being generated is not to spec. My >> problem is that I do not have the ability to change the tool generating >> the Excel file, and consequently am stuck with this file format. >> >> Is there anything in POI that would let me silently ignore these errors, >> or do I need to hack POI to get this to work? ie: I can use Spring AOP >> or AspectJ to intercept a thrown error and silently ignore it, but I >> consider that to be quite an ugly solution. > > In retrospect, my concept of using Spring or AspectJ to simply ignore the > error does not work given that the pointer does not know the correct start of > the next record and fails miserably. > > Any suggestions as to how I can "repair" an xls file such that poi will > understand it?
The first step is to identify where the problem is in the file. Take two files. One is the bad file, and two is the bad file after it is fixed by re-saving in Excel. Try the BiffViewer[1] on both and see how the dump differs. Report back with the differences and someone will help. Regards, Dave [1] http://poi.apache.org/apidocs/org/apache/poi/hssf/dev/BiffViewer.html > > Thanks, > > Eric > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
