Bug 62267 - Conditional formatting lost after paste special of text, numbers and dates.
Summary: Conditional formatting lost after paste special of text, numbers and dates.
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0.2.1 rc
Hardware: Other All
: medium major
Assignee: Markus Mohrhard
URL:
Whiteboard: target:4.2.0 target:4.1.0.2 target:6.1.0
Keywords:
: 63278 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-03-12 23:22 UTC by p_kongstad
Modified: 2018-03-18 11:10 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description p_kongstad 2013-03-12 23:22:17 UTC
If you have a cell with conditional formatting and you use paste special only inserting only text, numbers and dates the formatting is lost. Undo do not recover the conditional formatting.

What happening:
The conditional formatting lost.

Expected:
Conditional formatting should be untouched. Also an undo should bring back the conditional formatting.

To me it looks like two bad things are happening at the same time: Loosing the conditional formatting and second that it cannot be undone. So that's the reason I have assigned severity major

Version 4.0.2.0+ (Build ID: 3f04ec08b75d4ecb44ec3ec1230d2072d975c63)
TinderBox: Linux-x86_64@31-Release-Configuration-RHEL5-Baseline, Branch:libreoffice-4-0, Time: 2013-03-11_17:41:05
Comment 1 Markus Mohrhard 2013-03-12 23:46:52 UTC

*** This bug has been marked as a duplicate of bug 57661 ***
Comment 2 Rainer Bielefeld Retired 2013-04-09 06:07:23 UTC
"Bug 63278 - CONDITIONAL FORMATTING lost after 'copy & paste special-only number' from other cell" <https://bugs.freedesktop.org/show_bug.cgi?id=63278#c1> show that the core of this problem is not the same as in Bug 57661. 
Additionally this problem was not in 3.6.6.2, while Bug 57661 already appeared in 3.6.

@Markus:
Is Bug 57661 still open because you consider the fix incomplete (concerning this problem, for example?)
With my current knowledge I recommend to reopen this Bug and handle this problem separately
Comment 3 Michel Rudelle 2013-05-09 13:46:47 UTC
Hi,
I reopen this issue, it looks like bug 57661, but it is not the same:

1/ bug 57661 is clearly fixed, no more problem since 4.0.2 (I have been working a lot for about 2 months with CF)

2/ And I still find every day the problem here reported, but with the following remark:

Copy paste "only" or "Paste Special" (text, numbers or dates) apparently destroy CF, but if you look with Manage you will see that CF is still there. Another way to confirm it is to save and reopen your file: the CF is still active.
I found the following two ways to restore (undo does not work as you noticed)
 a/ save and reopen
 b/ with Manage > select the range > Edit > ok > ok (without doing anything)

Imho, and if you observe that also, this is a minor issue, but very boring because you think you loose your FC and trying to repair you might do some mistakes where there was nothing to do (so I don't change severity)

Latest test:
Version 4.0.3.3 (Build ID: 0eaa50a932c8f2199a615e1eb30f7ac74279539)-Vista-32b
Comment 4 rh_libre 2013-05-09 19:23:25 UTC
I think my bug report 63278 is a duplicate of this bug.

One workaround that works is to paste formatting (but only if the destination cells have the same conditional formatting as the originals). I've changed my Paste Special options on one spreadsheet to save an operation. However, I have another spreadsheet with different conditional formatting in the destination range, so I use the following...

It has been observed that the CF is still present but for some reason is not displayed. The easiest way to make it display once more is to select the affected cells (they're probably still selected from the Paste operation) then hit the Format Paintbrush then click on the first cell and watch the CF become displayed again.

In other words it *might* be a display refresh bug (requiring re-evaluation of the conditions after the values changed) rather than necessarily a plain CF bug.

(Running Version 4.0.2.2 (Build ID: 4c82dcdd6efcd48b1d8bba66bfe1989deee49c3) on Windows 7 32-bit)

Hope the workaround helps reduce frustration and chance of introducing errors until this is fixed.
Comment 5 Markus Mohrhard 2013-05-09 21:56:05 UTC
Regression introduced with the fix of Bug 60306.

I have a fix for it.
Comment 6 Markus Mohrhard 2013-05-09 22:06:18 UTC
*** Bug 63278 has been marked as a duplicate of this bug. ***
Comment 7 p_kongstad 2013-06-27 19:58:24 UTC
This bug is still present in Version: 4.1.0.1
Build ID: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155

To reproduce:

Click in cell A1 and open the dialog via Format / Conditional formatting / Condition.
Set the condition to Cell value | is equal to | 1 and apply style to Result 2.

Now you type 1 in A1. It shows the formatted value in cell A1.

Now you copy any other empty cell with standard formatting and use CTRL+SHIFT+V for pasting special. Please make sure that only Text | Numbers | Date & Time is marked. Then paste.

Expected:
Conditional formatting in cell A1 should be unchanged.

Result:
Conditional formatting lost.
Comment 8 Commit Notification 2013-06-29 01:05:53 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d4f631e8ceb7f02a18565cf0470c8170215e69f8

only clean the cond format if we want to write attribs, fdo#62267



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 rh_libre 2013-06-29 05:48:16 UTC
Thanks for the commit, Markus.

I'm not sure whether it was all included in the build

master~2013-06-29_01.02.58_LibreOfficeDev_4.2.0.0.alpha0_Win_x86.msi     29-Jun-2013 03:52  110M

Version: 4.2.0.0.alpha0+
Build ID: 5b9bad7482a98f2d0d37c4b75a13292abe653ea3
Windows 7 Professional 32-bit, AMD Turion, 4GB RAM

It certainly works with CFPasteBug.ods

However, I believe there's a regression in that build when used in a different spreadsheet. I hope to download another build tonight/tomorrow to see if anything else has been fixed.

With another, very much more complicated pair of spreadsheets, I'm copying a list of numbers from 12 cells within a column on one ODS file (the bottom cell does not contain Conditional Formatting). I then switch to the second ODS file and paste these in cells with a different CF formula in each using Right-click/Paste Only/Numbers. On this occasion, the first two numbers are not pasted at all, although the intended destination range is selected, but the last two cells are blank.

I need to spend time to narrow down the problem and post a new, far simpler attachment to demonstrate it. Unfortunately, I do not have time this morning, but might achieve something over the next 2 days.

Ryan / rhlibre
Comment 10 Michel Rudelle 2013-06-29 12:22:09 UTC
It's for me OK with today master (master~2013-06-29):
Version: 4.2.0.0.alpha0+ Build ID: 5b9bad7482a98f2d0d37c4b75a13292abe653ea3 [Vista-32b]
Thanks Markus

@Ryan / rhlibre: I couldn't reproduce what you explain when copying from one spreadsheet to another. So I'm waiting for your sample file.
Regards
Comment 11 Commit Notification 2013-07-01 13:31:15 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=336d684a940165d15b3581a72d8bd45743bf98ee&h=libreoffice-4-1

only clean the cond format if we want to write attribs, fdo#62267


It will be available in LibreOffice 4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 p_kongstad 2013-07-03 14:53:58 UTC
Seems to be resolved in Version: 4.1.0.1.0+
Build ID: 3875218079cae6f94d938b810109de0222485af

Will it be pushed to 4.0.x?
Comment 13 rh_libre 2013-07-03 15:20:45 UTC
I just tested the current Dev Build:

Version: 4.2.0.0.alpha0+
Build ID: 6f86d931b4266d00fec75c0124ac9fc3026a4f1b
TinderBox: Win-x86@6, Branch:master, Time: 2013-07-02_23:36:17

My previous possible regression when pasting from one workbook into another is not happening now. I have seen one or two display bugs, but this is not the place.
Comment 14 rh_libre 2013-07-04 08:30:18 UTC
> My previous possible regression when pasting from one workbook into another
> is not happening now. I have seen one or two display bugs, but this is not
> the place.

I can again confirm this, so it seems that all my issue with Conditional Format display are resolved. I don't think anyone else has had any problems.

Thanks for the fix, Markus, and to everybody who has contributed to this thread and related bugs previously.

I'm assigning the status RESOLVED, FIXED and look forward to it appearing in the stable release fairly soon (4.1, it seems)
Comment 15 rh_libre 2013-07-06 15:22:49 UTC
I've just opened a new Bug 66646 that applies only to the Dev Build,
https://bugs.freedesktop.org/show_bug.cgi?id=66646
with a simple demo spreadsheet attached.

I did finally replicate the problem I mentioned previously with Paste Special.../Add

It turns out that if I had Empty cells in the destination range they're no longer being treated as numerical zero and having the source value added to them. Instead they are skipped, which isn't the expected behaviour.
Comment 16 Michel Rudelle 2013-07-15 08:40:04 UTC
Hi,
It works fine with:
Version: 4.1.0.2.0 Build ID: 103a942746cfe346e87daab62acbd4268c38097
Vista-32b
Thanks a lot
Comment 17 Commit Notification 2018-03-18 11:10:56 UTC
Zdeněk Crhonek committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6709db941ff3257226f48212d2c36ee1b0d68200

uitest for tdf#62267

It will be available in 6.1.0.

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

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