Bug 141440

Summary: Comment deleted when pasting special Formula, Number or Text
Product: LibreOffice Reporter: romain2boss
Component: CalcAssignee: Andreas Heinisch <andreas.heinisch>
Status: RESOLVED FIXED    
Severity: normal CC: buzea.bogdan, peter, romain2boss
Priority: medium    
Version: 7.1.2.2 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=161189
Whiteboard: target:7.6.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108479    

Description romain2boss 2021-04-01 20:43:32 UTC
Steps to reproduce:
1. Open a new workbook
2. Type '=1+1' in A1
3. Create a comment 'My comment' in B1
4. Copy cell A1
5. Select B1
6. Do one of the following:
- Go into Edit > Paste special > Formula only
- Go into Edit > Paste special > Number only
- Go into Edit > Paste special > Text only
- Go into Edit > Paste special > Paste special..., uncheck everything and check ONLY formula or Number or Text

Observed: The formula/number/text got pasted in B1 (ok) but deleting the comment (ko).

Expected: The formula/number/text got pasted in B1 not changing/deleting the comment.

Nota: Similar to comments, merged cell also disappear when pasting formula only, see bug 106177
Comment 1 Peter S Anderson 2021-04-07 11:53:31 UTC
I have duplicated this bug in numerous versions including 4.5.0.0.alpha0, 5.4.0.0.alpha1, 7.0.5.2 and 7.2.0.0.alpha+, ie. I suspect Calc had always behaved this way.
I must admit that I personally find this behaviour really frustrating and should have raised the bug myself. I import data from CSV files all the time and use the paste values feature to retain formats but always lose any comments. Apart from being annoying, the behaviour is inconsistent with Excel and the fact that the Paste Special Popup includes a Selection box for Comments which implies that comments will NOT be copied if the box is not selected.
Comment 2 Commit Notification 2023-05-16 09:05:33 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/535f8fde0c33c435e4a8e9f768003516ce933666

tdf#141440 - Do not delete notes when pasting contents

It will be available in 7.6.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.