From 23003e75b3d70747fb7dc306d29c66a39cc6195e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 30 Jun 2020 20:45:14 +0000 Subject: [PATCH] fpspreadsheet: Fix usage of strings in compare operations for conditional formatting. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7505 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/xlsxooxml.pas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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