https://issues.apache.org/bugzilla/show_bug.cgi?id=55324

--- Comment #8 from [email protected] ---
(In reply to Nick Burch from comment #7)
> There might be a bug, it's always possible...
> 
> I'd suggest you try running BiffViewer on the file saved by POI, and then on
> a file loaded by excel + explicitly evaluated + saved. Find the formula
> record for the cell, and compare the POI one to the Excel one. Are the ptgs
> the same? Cached value the same? etc

it seems that cached value are the same but ptgs are not (one difference on
ptg[6])
here are ptgs generate by POI

[FORMULA]
    .row    = 0x0004
    .col    = 0x0004
    .xfindex= 0x000F
  .value     = <string> [00, 00, 00, 00, 00, 00]
  .options   = 0x0002
    .alwaysCalc= false
    .calcOnLoad= true
    .shared    = false
  .zero      = 0x00000000
    Ptg[0]=org.apache.poi.ss.formula.ptg.IntPtg [1].
    Ptg[1]=org.apache.poi.ss.formula.ptg.IntPtg [2].
    Ptg[2]=class org.apache.poi.ss.formula.ptg.GreaterThanPtg.
    Ptg[3]=org.apache.poi.ss.formula.ptg.AttrPtg [if dist=9].
    Ptg[4]=org.apache.poi.ss.formula.ptg.RefPtg [A5]R
    Ptg[5]=org.apache.poi.ss.formula.ptg.AttrPtg [skip dist=21].
    Ptg[6]=org.apache.poi.ss.formula.ptg.RefPtg [A5]R
    Ptg[7]=org.apache.poi.ss.formula.ptg.IntPtg [4].
    Ptg[8]=org.apache.poi.ss.formula.ptg.IntPtg [2].
    Ptg[9]=org.apache.poi.ss.formula.ptg.FuncPtg [MID nArgs=3]V
    Ptg[10]=org.apache.poi.ss.formula.ptg.AttrPtg [skip dist=3].
    Ptg[11]=org.apache.poi.ss.formula.ptg.FuncVarPtg [IF nArgs=3]V
[/FORMULA]

Offset=0x00003801(14337) recno=174 sid=0x0207 size=0x0005(5)
[STRING]
    .string            = $$
[/STRING]




ptgs generate by Excel

[FORMULA]
    .row    = 0x0004
    .col    = 0x0004
    .xfindex= 0x000F
  .value     = <string> [00, 00, 84, 2C, 4F, 06]
  .options   = 0x0000
    .alwaysCalc= false
    .calcOnLoad= false
    .shared    = false
  .zero      = 0xFE040005
    Ptg[0]=org.apache.poi.ss.formula.ptg.IntPtg [1].
    Ptg[1]=org.apache.poi.ss.formula.ptg.IntPtg [2].
    Ptg[2]=class org.apache.poi.ss.formula.ptg.GreaterThanPtg.
    Ptg[3]=org.apache.poi.ss.formula.ptg.AttrPtg [if dist=9].
    Ptg[4]=org.apache.poi.ss.formula.ptg.RefPtg [A5]R
    Ptg[5]=org.apache.poi.ss.formula.ptg.AttrPtg [skip dist=21].
    Ptg[6]=org.apache.poi.ss.formula.ptg.RefPtg [A5]V
    Ptg[7]=org.apache.poi.ss.formula.ptg.IntPtg [4].
    Ptg[8]=org.apache.poi.ss.formula.ptg.IntPtg [2].
    Ptg[9]=org.apache.poi.ss.formula.ptg.FuncPtg [MID nArgs=3]V
    Ptg[10]=org.apache.poi.ss.formula.ptg.AttrPtg [skip dist=3].
    Ptg[11]=org.apache.poi.ss.formula.ptg.FuncVarPtg [IF nArgs=3]V
[/FORMULA]

Offset=0x00001022(4130) recno=169 sid=0x0207 size=0x0005(5)
[STRING]
    .string            = $$
[/STRING]



$$ was the formula result value

Is this difference on ptg is important ? are there any solution ?

all Formula where re-evaluate before closing workbook.

if (_evaluator == null)
   _evaluator = _workbook.getCreationHelper().createFormulaEvaluator();
   _evaluator.clearAllCachedResultValues();
   for(int sheetNum = 0; sheetNum < _workbook.getNumberOfSheets(); sheetNum++)
{
      Sheet sheet = _workbook.getSheetAt(sheetNum);
    for(Row r : sheet) {
           for(Cell c : r) {
              if(c.getCellType() == Cell.CELL_TYPE_FORMULA) {
                 _evaluator.setDebugEvaluationOutputForNextEval(true);
                 _evaluator.evaluateFormulaCell(c);
              }
           }
        }
  }
_workbook.setForceFormulaRecalculation(true);

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to