Bug 119928 - Newline in cell formula are ignored when copy-pasting more than one cell in Calc 6.x
Summary: Newline in cell formula are ignored when copy-pasting more than one cell in C...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) rc
Hardware: All All
: high normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
: 128513 142277 142561 143915 (view as bug list)
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
Reported: 2018-09-17 12:06 UTC by antoine.monmayrant+bugdocumentfundation
Modified: 2023-05-18 15:07 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:

File to trigger the bug (contains detailed steps to reproduce the bug) (10.58 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-09-17 12:11 UTC, antoine.monmayrant+bugdocumentfundation

Note You need to log in before you can comment on or make changes to this bug.
Description antoine.monmayrant+bugdocumentfundation 2018-09-17 12:06:46 UTC
When copy-pasting multiple cells from Calc to a text editor, the newline present in the cells are ignored in LibreOffice Calc 6.x leading to unexpected copied text.
The bug is confirmed under both Linux and Windows and was not present in LibreOffice Calc 5.x.

Steps to Reproduce:
1. Create a cell (let's say A1) with a multiline content like (typed using Ctrl+Enter for line breaks:
2. Select both A1 and A2 (A2 can be empty)
3. Copy (Ctrl+C) the content of the cells
4. Paste as text in a text editor (notepad++, notepad, gedit, kate ...)

Actual Results:
The text editor contains one single line that reads:
line1 line2 line3

Expected Results:
The text editor should contain3 lines:

Reproducible: Always

User Profile Reset: No

Additional Info:
1) This bug is a regression: the normal behavior has been confirmed under both Linux & Windows using LibreOffice Calc 5.x versions.
2) This bug is only triggered when more than 1 cell is selected. If only the cell A1 in the above example is selected, the pasted text is correct (ie multiline).
3) This bug has been confirmed under Linux (Ubuntu 16.04 64bits) & Windows (7 pro 64 bits).


Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU threads: 16; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group threaded
Comment 1 antoine.monmayrant+bugdocumentfundation 2018-09-17 12:11:56 UTC
Created attachment 144938 [details]
File to trigger the bug (contains detailed steps to reproduce the bug)

Here is a sample file to reproduce the bug.
Comment 2 Oliver Brinzing 2018-09-17 17:12:30 UTC
confirming different behaviour:

LO 6.0.6:
Line1 Line2 Line3

Comment 3 QA Administrators 2019-09-18 02:54:29 UTC Comment hidden (obsolete)
Comment 4 Oliver Brinzing 2019-09-18 17:36:59 UTC Comment hidden (obsolete)
Comment 5 Timur 2021-08-17 15:06:26 UTC
*** Bug 143915 has been marked as a duplicate of this bug. ***
Comment 6 Timur 2021-08-17 15:13:49 UTC Comment hidden (obsolete)
Comment 7 Timur 2021-08-17 15:18:31 UTC
*** Bug 142277 has been marked as a duplicate of this bug. ***
Comment 8 Timur 2021-08-17 15:20:04 UTC
*** Bug 142561 has been marked as a duplicate of this bug. ***
Comment 9 Timur 2021-08-17 15:23:05 UTC
*** Bug 128513 has been marked as a duplicate of this bug. ***
Comment 10 Xisco Faulí 2021-08-17 16:23:58 UTC
Regression introduced by:


author	Eike Rathke <erack@redhat.com>	2017-11-14 17:39:41 +0100
committer	Eike Rathke <erack@redhat.com>	2017-11-14 17:40:15 +0100
commit 329eeefcbd65ea88f0c8c3f034d49ba73045d059 (patch)
tree 05032ad9b703a1089c2a04a7ce68a8bb34cfd0f2
parent ed89b432dff252d3b1a18ad7694bbf2c4abc36ff (diff)
Distinguish single/multiple cell copy for plain text, tdf#113571 follow-up

Bisected with: bibisect-linux64-6.0

Adding Cc: to Eike Rathke
Comment 11 Eike Rathke 2021-08-20 11:57:35 UTC
Read the source code comment in that commit.. in conjunction with bug 113571.
Comment 12 Timur 2021-08-20 13:11:26 UTC
I'm in favor of an option in Calc, if possible.
There will always be 2 groups of users and neither option is better. 
Problem now is that more general behavior is unexpected. 

Let me update this, interesting that behavior of editors is different:
> Windows paste to Notepad++ looses LF from LO 6.0 (this bug).
> Linux paste to Gedit keeps LF with quotes. 
> Paste to MSO Excel writes "multi" and loses "line" from before. 
> Paste to FreeOffice PlanMaker pastes properly before and after.
> Paste to WPS pastes "multi" and "line" in separate rows.
Comment 13 Patch 2021-08-22 10:47:51 UTC
My understanding in most other applications preserve the intra cell line breaks by
* Using the more advanced formats where possible eg html or rtf (both to read & write to the clipboard).

* Write to the clipboard, quoted special characters if required to preserve linefeeds. (Such as Microsoft Excel and Google Sheets)

This also happens transparently between LO applications.
LO Calc supports quoted intra-cell line feeds when reading the clipboard
LO Calc supports quoted intra-cell line feeds when saving as a CSV file

The time intra-cell line feeds are not preserved is when copying from LO calc to an applications which does not support formats other than plan text.

So I am not convinced that "more general behavior is unexpected"