[Bug 61700] New: getForceFormulaRecalculation() returns wrong value

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 61700] New: getForceFormulaRecalculation() returns wrong value

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61700

            Bug ID: 61700
           Summary: getForceFormulaRecalculation() returns wrong value
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

I think getForceFormulaRecalculation is implemented wrong.


Some logging code in my applicaiton
>>>
boolean forceFormulaRecalculation = workbook.getForceFormulaRecalculation();
log.error("Will excel recalculate? {}", forceFormulaRecalculation);
workbook.setForceFormulaRecalculation(true);
boolean forceFormulaRecalculation2 = workbook.getForceFormulaRecalculation();
>>>

Expected Behavior
- Will excel recalculate? false
- Will excel recalculate after setting to true? true


Actual behavior
- Will excel recalculate? true
- Will excel recalculate after setting to true? false


Shouldn't this line of code here be

return calcPr != null && calcPr.getCalcId() == 0;

https://github.com/apache/poi/blob/REL_3_17_FINAL/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java#L2232



Additional Context:
XSSF workbook

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61700] getForceFormulaRecalculation() returns wrong value

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61700

--- Comment #1 from Javen O'Neal <[hidden email]> ---
https://poi.apache.org/spreadsheet/eval.html#Recalculation+of+Formulas

@Test
public void testWorkbookForceFormulaRecalculation() throws Exception {
    Workbook workbook = _testDataProvider.createWorkbook();
    workbook.createSheet().createRow(0).createCell(0).setCellFormula("B1+C1");
    workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();

    assertFalse(workbook.getForceFormulaRecalculation());
    workbook.setForceFormulaRecalculation(true);
    assertTrue(workbook.getForceFormulaRecalculation());

    Workbook wbBack = _testDataProvider.writeOutAndReadBack(workbook);
    assertTrue(wbBack.getForceFormulaRecalculation());

    workbook.close();
    wbBack.close();
}

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]