Bug 133027 - LO Calc: Conditional Format formula issue, when you "cut-paste" the conditionally formatted cell range into another overlapping range.
Summary: LO Calc: Conditional Format formula issue, when you "cut-paste" the condition...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.2.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 145146 (view as bug list)
Depends on:
Blocks: Conditional-Formatting
  Show dependency treegraph
 
Reported: 2020-05-14 08:34 UTC by Tibor Kovács
Modified: 2023-10-16 13:36 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
CF issue demonstration (10.92 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-14 08:35 UTC, Tibor Kovács
Details
CF issue with non adjacent formatted cell ranges. (11.77 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-14 10:00 UTC, Tibor Kovács
Details
picture about the CF issue (25.32 KB, image/png)
2020-05-14 10:09 UTC, Tibor Kovács
Details
issue with multiple formatted non-adjacent cell ranges (121.29 KB, image/jpeg)
2020-05-14 10:14 UTC, Tibor Kovács
Details
screenshot for previous comment (157.65 KB, image/jpeg)
2020-10-31 12:38 UTC, b.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tibor Kovács 2020-05-14 08:34:09 UTC
Description:
When you "cut-paste" the conditionally formatted cell range, the reference of the CF formula go wrong. Using relative references, the formula must populate "paralell" with the distance of the "cut place" and the "paste place". But it not work properly.

Steps to Reproduce:
See the attachment.
1. The red cell E8 was formatted by CF formula with relative reference in the condition: D8=1. The name of the applied Cell Style is „Error”.
2. Then the yellow and the red cell have been copied down to D17.
3. Check the setting of the CF in the Manage Conditional Format feature: The CF formula and range have been integrated into one condition – as it is expected.
4. Select, Cut and then Paste the colorized block (D8:E17) down by some rows. (if you move the range less than 10 rows down you will prompt see the strange behavior) 
5. Check again the formula of the CF
6. You will see: the reference of the CF formula changed by double value relative to the distance of the „paste location-original place”


Actual Results:
the CF formula changed by double value relative to the distance of the „paste location-original place”

Expected Results:
the CF formula must be changed same value relative to the distance of the „paste location-original place”


Reproducible: Always


User Profile Reset: No



Additional Info:
The attached file was created in the LO 6.4.3 winPenPack portable version, but the issue is present in my permanently installed LO 6.2.8 and the LO 6.1.6 too.
Comment 1 Tibor Kovács 2020-05-14 08:35:57 UTC
Created attachment 160808 [details]
CF issue demonstration

LO Calc CF issue demonstration
Comment 2 Tibor Kovács 2020-05-14 08:41:35 UTC
The issue is present in many LO version (Checked in some 6.x.x versions), and it present in the clean-installed LibreOffice versions (first LO installation on a newly (re)installed operating sytem) too. We are using Win7 x64 Pro and Win10 x64 pro and 64 bit LibreOffice version.
Comment 3 Ming Hua 2020-05-14 09:30:07 UTC
Can't reproduce with either 6.2.8 or 7.0.0 alpha1 on Windows 10.

My exact steps are:
1. Open attached example file;
2. Use mouse-dragging to select D8:E17 range;
3. Edit > Cut;
4. Click in cell D21;
5. Edit > Paste.

Result: colored block are cut-and-pasted successfully with both yellow and red colors, Format > Conditional Formatting > Manage... dialog shows the block has the same condition "D21=1".  Using keyboard Ctrl+X and Ctrl+V in steps 3 and 5 makes no difference.

Are you using different actions to cut and paste?
Comment 4 Tibor Kovács 2020-05-14 09:54:52 UTC
"Are you using different actions to cut and paste?"

Absolutely not. And the issue is present, when I grag the the selected cell range down by two rows.


Try to move the cell range less rows down. Select cell D10 to paste. You will see the issue prompt.





(I am using Hungarian locale settings, and alternate English/Hungarian user interface languages.)
Comment 5 Tibor Kovács 2020-05-14 10:00:31 UTC
Created attachment 160810 [details]
CF issue with non adjacent formatted cell ranges.

Try again to paste the selected and cutted D8:E17 cellrange (only that cell range!) to the D21 position.
Comment 6 Tibor Kovács 2020-05-14 10:03:10 UTC
I just uploaded an another version of my sample file. Now, there are two non-adjacent cellranges with same relative condition formula.

Please try again to paste the selected and cutted D8:E17 cellrange (only that cell range!) into the D21 position. Then check the formula.
Comment 7 Ming Hua 2020-05-14 10:08:56 UTC
(In reply to Tibor Kovács from comment #4)
> Try to move the cell range less rows down. Select cell D10 to paste. You
> will see the issue prompt.

Right, clicking in D11 and pasting reproduced the bug.  I misunderstood your instruction of "move less than 10 rows".  In retrospect it's obvious as overlapping cut and paste areas is a common source of bugs.

My LO version:
Version: 7.0.0.0.alpha1 (x64)
Build ID: 6a03b2a54143a9bc0c6d4c7f1...
CPU 线程: 2; 操作系统: Windows 10.0 Build 18363; UI 渲染: Skia/Raster; VCL: win; 
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded

> (I am using Hungarian locale settings, and alternate English/Hungarian user
> interface languages.)
I have Chinese UI here, so locale shouldn't be relevant.
Comment 8 Tibor Kovács 2020-05-14 10:09:51 UTC
Created attachment 160811 [details]
picture about the CF issue

Here is a picture about the CF issue (after Cut&Paste) when only one conditionally formatted cell range is present.
Comment 9 Tibor Kovács 2020-05-14 10:14:51 UTC
Created attachment 160812 [details]
issue with multiple formatted non-adjacent cell ranges

And here is a picture about the issue with multiple formatted non-adjacent cell ranges.
Comment 10 Ming Hua 2020-05-14 10:19:21 UTC
Also reproducible with 5.2.7:
Version: 5.2.7.2 (x64)
Build ID: 2b7f1e640c46ceb28adf43ee075a6e8b8439ed10
CPU Threads: 2; OS Version: Windows 6.19; UI Render: default; 
Locale: zh-CN (zh_CN); Calc: group
Comment 11 Tibor Kovács 2020-05-15 04:50:53 UTC
The behavior of the LO 4.4.7 (I have only a portable version today):

The issue is present in files containing the FC cells created in the LO 6.x.x  when I open them in the LO 4.4.7.

But there is not any issue with files created in LO 4.4.7. The LO 4.4.7 can handle the Cut/Paste of the CF-ed range.
And the LO 6.x.x versions can work wellthe CF created in the LO 4.4.7

- - - 
A presumed reason:

The LO 4.4.7 can not merge the CF reference of the adjacent cells into one range reference.

The reference list for my first sample file (containing one CF cell range; recreated in LO 4.4.7) is:

E8
E9
E10
E11
E12
E13
E14
E14
E16
E17

And the LO 6.x.x works well with this list, but is can not work with the impoved (joint, combined) "E8:E17" type reference.
Comment 12 Ming Hua 2020-05-15 07:09:59 UTC
(In reply to Tibor Kovács from comment #11)
> A presumed reason:
> 
> The LO 4.4.7 can not merge the CF reference of the adjacent cells into one
> range reference.

Good to know.

I tested 5.2.7 again with manually created CF from empty spreadsheet, that version can already combine adjancent cells with CF into one range, like in your example.  So the change happened some time between 4.4 and 5.2.
Comment 13 Tibor Kovács 2020-09-08 19:40:06 UTC
...Any (good or bad) news about the bug...?
Comment 14 b. 2020-10-31 12:23:22 UTC
there are atomic fails, at least two: 

1.) one cell with a value, one cell referencing that value for conditional format, 

moving the referenced! cell by either 'ctrl-x' - 'ctrl-v' or by 'mouse-push' cleanly adapts the relative referencing in the conditional format formula, ok, 

moving the referencing! cell either by ctrl-x ctrl-v or by 'mouse-push' does not! adapt the relative referencing in the conditional format formula, not ok, 

(the reference points to a new cell with identical relative position to the moved cell as the old 'target', behaviour as it should be for copying! the referencing cell), 

2.) (may result from above) moving a range of cells containing as well the conditional formatted cell(s) as the reference(s) for formatting (wich shouldn't be the cell itself, neither referenced by 'cell value' nor by a formula pointing to itself), to an 'overlapping position' (mostly) adapts the formatted range and the relative formula by double the value of the move, with the funny side effect that on move left or down it is evaluated acc. the new wrong references and thus fails, but on move right or up the evaluation is also erroneous and the result looks good ... only looks but isn't as the formula is wrong (see attached screenshot), and as the construction doesn't survive save-load, 

tested with 7.1.0 alpha win7x64, 

history: ver. 3.5.1.2 didn't adapt relative referencing in any way, 4.1.6.2 did but already has both above fails (a little different as it has different handling for grouping of formattings), 

i admit ... programming such stuff is challenging, estimate working with parts of formatted ranges, or parting / breaking referenced ranges ... 

boiled down, now it only needs an interested dev ...
Comment 15 b. 2020-10-31 12:38:30 UTC
Created attachment 166892 [details]
screenshot for previous comment

see erroneous range and formula displayed, doesn't survive save-load,
Comment 16 Tibor Kovács 2021-10-15 05:01:29 UTC
Is there any hope for a solution????
Comment 17 m_a_riosv 2021-10-15 16:55:03 UTC
*** Bug 145146 has been marked as a duplicate of this bug. ***
Comment 18 QA Administrators 2023-10-16 03:15:07 UTC Comment hidden (obsolete)
Comment 19 Tibor Kovács 2023-10-16 13:31:29 UTC
Ther reported bug is present in the LO7.5.7 and in the LO7.6.2 versions.
Tested with the originally uploaded sample file, and with newly created Calc file too.
Comment 20 Tibor Kovács 2023-10-16 13:36:24 UTC
The reported bug is not present the old version of the LO. I can repeat the reasons posted in the past:

"
The behavior of the LO 4.4.7 (I have only a portable version today):

The issue is present in files containing the FC cells created in the LO 6.x.x  when I open them in the LO 4.4.7.

But there is not any issue with files created in LO 4.4.7. The LO 4.4.7 can handle the Cut/Paste of the CF-ed range.
And the LO 6.x.x versions can work wellthe CF created in the LO 4.4.7

- - - 
A presumed reason:

The LO 4.4.7 can not merge the CF reference of the adjacent cells into one range reference.

The reference list for my first sample file (containing one CF cell range; recreated in LO 4.4.7) is:

E8
E9
E10
E11
E12
E13
E14
E14
E16
E17

And the LO 6.x.x works well with this list, but is can not work with the impoved (joint, combined) "E8:E17" type reference.

"