Bug 160117 - Conditional formatting handling bug in Calc 24.2 with different but overlapping ranges
Summary: Conditional formatting handling bug in Calc 24.2 with different but overlappi...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.1.2 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.2.2
Keywords: bibisected, bisected, possibleRegression
Depends on:
Blocks: Conditional-Formatting-Managing
  Show dependency treegraph
 
Reported: 2024-03-09 12:09 UTC by barruel
Modified: 2024-03-22 09:11 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file showing the reported issue (20.38 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-03-09 21:27 UTC, barruel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description barruel 2024-03-09 12:09:37 UTC
As explained in LO's Community thread at https://ask.libreoffice.org/t/conditional-formatting-possible-bug-in-calc-24-2/103079 Calc 24.2.1.2 (and the previous 24.2) is handling the conditional formatting conditions in a different way that 7.6.x used to handle them.

The thread contains screenshots and test files.

The issue appears when there is set of conditions that apply to different but overlapping cell ranges. It would be no issue if there was a way to set priorities between ranges in the main Conditional formatting "Manage..." window, but the priorities are only settable inside the set of conditions of each separate range.
Comment 1 Mike Kaganski 2024-03-09 12:41:18 UTC
(In reply to barruel from comment #0)
> The thread contains screenshots and test files.

No test files there.
Comment 2 Werner Tietz 2024-03-09 13:17:06 UTC
changed to »resolved…NOTOURBUG« because https://ask.libreoffice.org/t/conditional-formatting-possible-bug-in-calc-24-2/103079 bug on Layer8
Comment 3 ady 2024-03-09 14:31:28 UTC
(In reply to Werner Tietz from comment #2)
> changed to »resolved…NOTOURBUG«

Sorry but that makes no sense.

We still need a spreadsheet sample with the problematic conditional formatting that shows a different result between LO 7.6 and 24.2 in order to try to replicate the problem.
Comment 4 barruel 2024-03-09 21:27:50 UTC
Created attachment 193041 [details]
Test file showing the reported issue
Comment 5 barruel 2024-03-09 21:31:55 UTC
Comments about the test file attached:

Two styles which apply white and gray backgrounds to every other row are applied to cells A4:I12;A13:I20 through formulas "MOD(ROW();2)=1" (for gray background) and "MOD(ROW();2)=0" (for white background).

Then two separate sets of identical conditions apply styles to make text italic with formulas "AND(MOD(ROW();2)=1;OR($C4="NP";$C4="EB";$C4="CP")" (for grey background italic text) and "AND(MOD(ROW();2)=0;OR($C4="NP";$C4="EB";$C4="CP")". These are applied to cell ranges A4:I12 and A13:I20.

Calc 7.6.x shows italic text when "NP", "EB" or "CP" is present in the $C4 or $C13 columns, as set in the Conditional formatting formulas. Calc 24.2.+ does not.
Comment 6 barruel 2024-03-09 22:04:46 UTC
(In reply to Werner Tietz from comment #2)
> changed to »resolved…NOTOURBUG« because
> https://ask.libreoffice.org/t/conditional-formatting-possible-bug-in-calc-24-
> 2/103079 bug on Layer8

No bug on layer 8.

You can check it yourself with the test file attached. 7.6.x and 24.2+ display different things.
Comment 7 QA Administrators 2024-03-10 03:15:36 UTC Comment hidden (noise)
Comment 8 ady 2024-03-10 08:38:45 UTC
There seems to be some priority difference between LO 7.6 and 24.2, in the way different conditional format rules are applied on overlapping ranges.

I am not sure whether this change is intentional or not.

In Manage Conditional Format:

* the first range is A4:I12, which has 2 conditional rules; both rules have a style that includes the italic format.

* the second range, A4:I12;A13:I20, partially overlaps with the first one, and this second range also has 2 conditional rules; both of these rules do _not_ include the italic format in their respective styles.

* there is a third range, A13:I20, which has 2 conditional rules; both rules have a style that includes the italic format. The rules for this third range are equivalent to the rules used for the first range, A4:I12.


The resulting render in LO 7.6 shows the italic format, whereas in LO 24.8 alpha it does not.


We could be tempted to criticize the way these ranges were originally formed, or whether these should be automatically and forcefully combined – to which I have expressed my opposition in other reports – but that would be off-topic. The main point here is that the resulting render is different, suggesting that the priority regarding the overlapping ranges is different in LO 24.2 than in LO 7.6.

Please note that the priority regarding the conditions themselves, within each set of ranges, might or might not be the problem; we would need a different example in order to test this.

The difference between LO 7.6 and 24.2 seems to be in how the overlapping ranges are combined; which exact set of conditions takes priority.

Please also note that, in this sample file, the set of ranges are not necessarily equal; the overlapping is "partial" (A4:I12 vs A4:I12;A13:I20), but it could had been even more fragmented (say, A4:I14;A6:J20 or whatever).


Again: I'm not suggesting to force the unification of ranges, and IDK whether this difference in priority was intentional; this sample case might just be a consequence of an intentional change in Calc.
Comment 9 raal 2024-03-11 16:33:14 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-24.2.
Adding Cc: to Paris Oplopoios ; Could you possibly take a look at this one?
Thanks
 9eca2989fd8c53037b0f95d7d8b715f16ee1d2a0 is the first bad commit
commit 9eca2989fd8c53037b0f95d7d8b715f16ee1d2a0
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Wed Nov 1 20:18:46 2023 +0100

    source edbc3a09edcf58a4738b4648811a065f3f55bc7c

158702: sc: Don't end handleConditionalFormat early | https://gerrit.libreoffice.org/c/core/+/158702
Comment 10 Mike Kaganski 2024-03-12 16:22:43 UTC
https://gerrit.libreoffice.org/c/core/+/164687
Comment 11 Commit Notification 2024-03-13 06:23:00 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/61580fcbd10bad2e0aab663d4c8fe43c1e01f92c

tdf#160117: check bAnyCondition

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2024-03-13 11:21:41 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/53b8a4c687df83a91e584fb6afa6729d9669f454

tdf#160117: check bAnyCondition

It will be available in 24.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 barruel 2024-03-15 22:42:51 UTC
Tested both the test file posted here and my original .ods file showing the issue on March 14th build.

Both files display correctly, just as LO 7.6 and Excel 2016 do.

Great work.

Thanks, Mike Kaganski.
Comment 14 Commit Notification 2024-03-20 07:59:30 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-2":

https://git.libreoffice.org/core/commit/a541f33b30e4c95ef69128e60ba4cc86ba8d585e

tdf#160117: check bAnyCondition

It will be available in 24.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2024-03-22 09:11:24 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c6518dc58f76ad9b59a61dd3736abd62acc5fc57

tdf#160117: vcl_pdfexport2: Add unittest

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.