diff --git a/components/fpspreadsheet/examples/other/ignore_formulas/demo_ignore_formula.lpr b/components/fpspreadsheet/examples/other/ignore_formulas/demo_ignore_formula.lpr index e4429c249..306312ea8 100644 --- a/components/fpspreadsheet/examples/other/ignore_formulas/demo_ignore_formula.lpr +++ b/components/fpspreadsheet/examples/other/ignore_formulas/demo_ignore_formula.lpr @@ -6,7 +6,7 @@ confirmation must be given to save the file because it has been changed by LOCalc. - This method does not work with Excel because it writes an additonal + This method does not work with Excel because it writes an additional folder and xml files for external links. } program demo_ignore_formula; diff --git a/components/fpspreadsheet/source/common/fpspreadsheet.pas b/components/fpspreadsheet/source/common/fpspreadsheet.pas index 9fced0771..88a2205a5 100644 --- a/components/fpspreadsheet/source/common/fpspreadsheet.pas +++ b/components/fpspreadsheet/source/common/fpspreadsheet.pas @@ -4783,12 +4783,14 @@ begin exit; end; - if not (boIgnoreFormulas in Workbook.Options) then - begin - // Remove '='; is not stored internally - if (AFormula[1] = '=') then - AFormula := Copy(AFormula, 2, Length(AFormula)); + // Remove '='; is not stored internally + if (AFormula[1] = '=') then + Delete(AFormula, 1, 1); + if (boIgnoreFormulas in Workbook.Options) then + formula := FFormulas.AddFormula(ACell^.Row, ACell^.Col, AFormula) + else + begin parser := TsSpreadsheetParser.Create(self); try if ALocalized then