diff --git a/components/fpspreadsheet/source/common/xlsxooxml.pas b/components/fpspreadsheet/source/common/xlsxooxml.pas index c4cae163b..8975935b9 100644 --- a/components/fpspreadsheet/source/common/xlsxooxml.pas +++ b/components/fpspreadsheet/source/common/xlsxooxml.pas @@ -3404,9 +3404,17 @@ begin case ARule.Condition of cfcEqual..cfcNotBetween: begin - formula1Str := Format('%s', [ARule.Operand1]); + s := VarToStr(ARule.Operand1); + if VarIsStr(ARule.Operand1) then + s := UTF8TextToXMLText(SafeQuoteStr(s)); + formula1Str := Format('%s', [s]); if (ARule.Condition in [cfcBetween, cfcNotBetween]) then - formula2Str := Format('%s',[ ARule.Operand2]); + begin + s := VarToStr(ARule.Operand2); + if VarIsStr(ARule.Operand2) then + s := UTF8TextToXMLText(SafeQuoteStr(s)); + formula2Str := Format('%s', [s]); + end; end; cfcAboveAverage..cfcBelowEqualAverage: begin