@@ -14,11 +14,11 @@ class Workbook extends WriterPart
1414 /**
1515 * Write workbook to XML format.
1616 *
17- * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing
17+ * @param bool $preCalculateFormulas If true, formulas will be calculated before writing
1818 *
1919 * @return string XML Output
2020 */
21- public function writeWorkbook (Spreadsheet $ spreadsheet , bool $ recalcRequired = false ): string
21+ public function writeWorkbook (Spreadsheet $ spreadsheet , bool $ preCalculateFormulas = false ): string
2222 {
2323 // Create XML writer
2424 if ($ this ->getParentWriter ()->getUseDiskCaching ()) {
@@ -57,7 +57,7 @@ public function writeWorkbook(Spreadsheet $spreadsheet, bool $recalcRequired = f
5757 (new DefinedNamesWriter ($ objWriter , $ spreadsheet ))->write ();
5858
5959 // calcPr
60- $ this ->writeCalcPr ($ objWriter , $ recalcRequired );
60+ $ this ->writeCalcPr ($ objWriter , $ preCalculateFormulas );
6161
6262 $ objWriter ->endElement ();
6363
@@ -146,9 +146,9 @@ private function writeWorkbookProtection(XMLWriter $objWriter, Spreadsheet $spre
146146 /**
147147 * Write calcPr.
148148 *
149- * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing
149+ * @param bool $preCalculateFormulas If true, formulas will be calculated before writing
150150 */
151- private function writeCalcPr (XMLWriter $ objWriter , bool $ recalcRequired = true ): void
151+ private function writeCalcPr (XMLWriter $ objWriter , bool $ preCalculateFormulas = true ): void
152152 {
153153 $ objWriter ->startElement ('calcPr ' );
154154
@@ -157,10 +157,10 @@ private function writeCalcPr(XMLWriter $objWriter, bool $recalcRequired = true):
157157 // because the file has changed
158158 $ objWriter ->writeAttribute ('calcId ' , '999999 ' );
159159 $ objWriter ->writeAttribute ('calcMode ' , 'auto ' );
160- // fullCalcOnLoad isn't needed if we've recalculating for the save
161- $ objWriter ->writeAttribute ('calcCompleted ' , ($ recalcRequired ) ? '1 ' : '0 ' );
162- $ objWriter ->writeAttribute ('fullCalcOnLoad ' , ($ recalcRequired ) ? '0 ' : '1 ' );
163- $ objWriter ->writeAttribute ('forceFullCalc ' , ($ recalcRequired ) ? '0 ' : '1 ' );
160+ // fullCalcOnLoad isn't needed if we will calculate before writing
161+ $ objWriter ->writeAttribute ('calcCompleted ' , ($ preCalculateFormulas ) ? '1 ' : '0 ' );
162+ $ objWriter ->writeAttribute ('fullCalcOnLoad ' , ($ preCalculateFormulas ) ? '0 ' : '1 ' );
163+ $ objWriter ->writeAttribute ('forceFullCalc ' , ($ preCalculateFormulas ) ? '0 ' : '1 ' );
164164
165165 $ objWriter ->endElement ();
166166 }
0 commit comments