recalc.setEngineId(0);
}
+ /**
+ * Whether Excel will be asked to recalculate all formulas when the workbook is opened.
+ *
+ * @since 3.8
+ */
+ public boolean getForceFormulaRecalculation(){
+ InternalWorkbook iwb = getWorkbook();
+ RecalcIdRecord recalc = (RecalcIdRecord)iwb.findFirstRecordBySid(RecalcIdRecord.sid);
+ return recalc != null && recalc.getEngineId() != 0;
+ }
+
+
}
void setForceFormulaRecalculation(boolean value);
/**
- * Whether Excel will be asked to recalculate all formulas when the
+ * Whether Excel will be asked to recalculate all formulas in this sheet when the
* workbook is opened.
*/
boolean getForceFormulaRecalculation();
*/
public void setForceFormulaRecalculation(boolean value);
+ /**
+ * Whether Excel will be asked to recalculate all formulas when the workbook is opened.
+ *
+ * @since 3.8
+ */
+ boolean getForceFormulaRecalculation();
+
}
_wb.setForceFormulaRecalculation(value);
}
+ /**
+ * Whether Excel will be asked to recalculate all formulas when the workbook is opened.
+ */
+ public boolean getForceFormulaRecalculation(){
+ return _wb.getForceFormulaRecalculation();
+ }
+
//end of interface implementation
}
// in the workbook the next time the file is opened.
calcPr.setCalcId(0);
}
+
+ /**
+ * Whether Excel will be asked to recalculate all formulas when the workbook is opened.
+ *
+ * @since 3.8
+ */
+ public boolean getForceFormulaRecalculation(){
+ CTWorkbook ctWorkbook = getCTWorkbook();
+ CTCalcPr calcPr = ctWorkbook.getCalcPr();
+ return calcPr != null && calcPr.getCalcId() != 0;
+ }
+
}
public void testRecalcId() {
XSSFWorkbook wb = new XSSFWorkbook();
+ assertFalse(wb.getForceFormulaRecalculation());
CTWorkbook ctWorkbook = wb.getCTWorkbook();
assertFalse(ctWorkbook.isSetCalcPr());
assertEquals(0, (int) calcPr.getCalcId());
calcPr.setCalcId(100);
+ assertTrue(wb.getForceFormulaRecalculation());
+
wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
assertEquals(0, (int) calcPr.getCalcId());
+ assertFalse(wb.getForceFormulaRecalculation());
}
}
public void testRecalcId(){
HSSFWorkbook wb = new HSSFWorkbook();
+ assertFalse(wb.getForceFormulaRecalculation());
+
InternalWorkbook iwb = TestHSSFWorkbook.getInternalWorkbook(wb);
int countryPos = iwb.findFirstRecordLocBySid(CountryRecord.sid);
assertTrue(countryPos != -1);
record.setEngineId(100);
assertEquals(100, record.getEngineId());
+ assertTrue(wb.getForceFormulaRecalculation());
wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
assertEquals(0, record.getEngineId());
+ assertFalse(wb.getForceFormulaRecalculation());
}
}