// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("A1").setValue(1); worksheet.getRange("A2").setFormula("=A1"); worksheet.getRange("A3").setFormula("=SUM(A1, A2)"); //when get value, calc engine will first calculate and cache the result, then returns the cached result. Object value_A2 = worksheet.getRange("A2").getValue(); Object value_A3 = worksheet.getRange("A3").getValue(); //disable calc engine. workbook.setEnableCalculation(false); //Dirty() method will mark the cached value of the workbook as dirty. workbook.dirty(); //Change A1 value worksheet.getRange("A1").setValue(2); //Calculate() will not work, because of workbook.EnablCalculation is false. workbook.calculate(); //it returns the wrong cached value because of calc engine is turned off. Object value_A2_1 = worksheet.getRange("A2").getValue(); Object value_A3_1 = worksheet.getRange("A3").getValue(); //enable calc engine. workbook.setEnableCalculation(true); //Dirty() method will mark the cached value of the workbook as dirty. worksheet.getRange("A2:A3").dirty(); //Calculate() method will calculate and cache the new result, it will return the cache value directly when get value later. worksheet.getRange("A2:A3").calculate(); //it returns cache value directly, does not calculate again. Object value_A2_2 = worksheet.getRange("A2").getValue(); Object value_A3_2 = worksheet.getRange("A3").getValue(); // Save to an excel file workbook.save("DirtyAndCalculation.xlsx");