From 4bda2d87506482750c30d13e5660cd68200ccc3e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 25 May 2023 15:33:02 +0000 Subject: [PATCH] fpspreadsheet: Fix the xxxxIF formulas (COUNTIF, SUMIF, ...) to be case-insensitive (https://forum.lazarus.freepascal.org/index.php/topic,63474.msg480757.html) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8822 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/fpsfunc.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpsfunc.pas b/components/fpspreadsheet/source/common/fpsfunc.pas index eb3f77ee2..9af4c4892 100644 --- a/components/fpspreadsheet/source/common/fpsfunc.pas +++ b/components/fpspreadsheet/source/common/fpsfunc.pas @@ -1306,7 +1306,7 @@ var coGreater : if ANumber > compareNumber then ok := true; coLessEqual : if ANumber <= compareNumber then ok := true; coGreaterEqual : if ANumber >= compareNumber then ok := true; - coNotEqual : if ANumber >= compareNumber then ok := true; + coNotEqual : if ANumber <> compareNumber then ok := true; end; if ok then case AFlag of @@ -1321,13 +1321,14 @@ var ok: Boolean; begin ok := false; + AStr := UTF8Lowercase(AStr); case compareOp of coEqual : if AStr = compareStr then ok := true; coLess : if AStr < compareStr then ok := true; coGreater : if AStr > compareStr then ok := true; coLessEqual : if AStr <= compareStr then ok := true; coGreaterEqual : if AStr >= compareStr then ok := true; - coNotEqual : if AStr >= compareStr then ok := true; + coNotEqual : if AStr <> compareStr then ok := true; end; if ok then case AFlag of @@ -1398,7 +1399,7 @@ begin end; cctUTF8String: begin - compareStr := cell^.UTF8StringValue; + compareStr := UTF8Lowercase(cell^.UTF8StringValue); compareType := ctString; end; cctEmpty: @@ -1433,7 +1434,7 @@ begin end else begin - compareStr := s; + compareStr := UTF8Lowercase(s); compareType := ctString; end; end;