On Tue, 19 Feb 2008, Josh Micich wrote:
Around line 160 there is a reverse iteration loop over the shared formula records. The fix to 44449 was to limit the content of the sharedFormulas list (around line 140). Without that fix, this reverse loop causes a version of the bug which is much easier to reproduce: Make a spreadsheet with a 2 distinct shared formulas - one in Sheet1!A1:A8 and another in Sheet2:A1:A8. Then use POI to read the cell formula for Sheet1!A2. It will incorrectly give the shared formula from the second sheet.

Is there some record in the steam we can use to spot when we move from one sheet to the next one?

And now to lay some blame ...
svn blame 
src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
...
610216       nick                 // Traverse the list of shared formulas in
610216       nick                 //  reverse order, and try to find
the correct one
610216       nick                 //  for us
426082    jheight                 boolean found = false;
426082    jheight                 for (int i=sharedFormulas.size()-1;i>=0;i--) {

I think I was just tidying up the comment when I tweaked it...

Changing the loop back to the forward direction does not break any junits. I put a comment in the code to that effect.

My best guess is it's like that for repeatedly saved files (so there is an old version and a new version of the record), or in the case of overlapping shared formulas (eg A1->A3 then A1->B6 or something like that). Does that sound likely to anyone else?


If we can find some record / condition that'll let us break the shared records up into one group per sheet, that'd seem to me to be the ideal fix.

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to