diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 951e10e3d..26295f1bd 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -3213,21 +3213,6 @@ begin end; *) -procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow, - ACol: Cardinal; const AFormula: TsFormula; ACell: PCell); -begin - Unused(AStream, ARow, ACol); - Unused(AFormula, ACell); -{ // The row should already be the correct one - FContent := FContent + - ' ' + LineEnding + - ' ' + AFormula.DoubleValue + '' + LineEnding + - ' ' + LineEnding; - -1833 -} -end; - { Writes an empty cell @@ -3623,6 +3608,47 @@ begin Result := ''; end; +{ Writes a string formula } + +procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow, + ACol: Cardinal; const AFormula: TsFormula; ACell: PCell); +var + lStyle: String = ''; + lIndex: Integer; +begin + Unused(AStream, ARow, ACol); + Unused(AFormula, ACell); + + if ACell^.UsedFormattingFields <> [] then begin + lIndex := FindFormattingInList(ACell); + lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" '; + end else + lStyle := ''; + + // We are writing a very rudimentary formula here without result and result + // data type. Seems to work... + AppendToStream(AStream, Format( + '' + + '', [ + ACell^.FormulaValue.FormulaStr, lStyle + ])); + +{ + + 982093:14:16 + + } + +{ // The row should already be the correct one + FContent := FContent + + ' ' + LineEnding + + ' ' + AFormula.DoubleValue + '' + LineEnding + + ' ' + LineEnding; + +1833 +} +end; + { Writes a cell with text content