Bug 118858 - Copying selected filtered cells copies all cells in range to external app instead of only selected
Summary: Copying selected filtered cells copies all cells in range to external app in...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 125734 146709 (view as bug list)
Depends on:
Blocks: Cut-Copy
  Show dependency treegraph
 
Reported: 2018-07-20 14:21 UTC by Tim Kite
Modified: 2024-12-12 13:02 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (8.91 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-07-30 10:05 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Kite 2018-07-20 14:21:04 UTC
Description:
Found an interesting bug in the latest (6.0.5.2) and previous (6.0.4.2) LibreOffice Calc on MacOS 10.13.6. It may have occurred in earlier releases in the 6.x branch, but I haven't had the occasion to test those. I've not tried in other operating systems.

When selecting cells in a filtered table and copying them to the clipboard, I would normally expect only the selected visible cells to be copied. However, what I see is that all cells in the range (including cells filtered out based on my filter) are copied as well, if I view the clipboard directly as plain text.

What is actually pasted seems to depend on the target application, however. Other LibreOffice apps get only what I've selected, as do other competing office applications. Plain text editors, on the other hand, get the whole range (exactly what's in the clipboard).

It may be the exact object copied to the clipboard contains the whole range with certain metadata indicating to compatible apps what should be shown (which would allow copying the whole range with the filter in place between spreadsheets), but this would seem to be a counter-intuitive behavior, and it's certainly a new behavior. In the 5.x branch of LibreOffice the expected behavior (only visible selected cells are copied) occurs.

Interestingly, with some external text editors (TextMate, for example) I can select the visible cells with the mouse, then drag-and-drop paste into the editor exactly the cells you have selected, but that operation doesn't use the MacOS clipboard.

Steps to Reproduce:
1. Create a multi-column, multi-row spreadsheet with a header row. For example:

Number,Day
one,Monday
two,Monday
three,Wednesday
four,Friday
five,Tuesday
six,Monday

2. Filter the sheet so only rows with "Monday" in the Day column are shown.
3. Select the now visible cells from the Number column:

one
two
six

4. Select Edit -> Copy or press command+C
5. Open a program that can receive text that isn't part of Libre Office, such as Text Edit.
6. Paste

Actual Results:
Observe that you jut pasted:

one
two
three
four
five
six

Expected Results:
What should have been pasted:

one
two
six


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
I'm viewing the clipboard pre-paste with an app called Pastebot, which stores clipboard history beyond the current clipboard and lets you view or perform actions on the current clipboard. It does not modify the clipboard until instructed to.
Comment 1 raal 2018-07-20 14:45:36 UTC
No repro with Version: 6.2.0.0.alpha0+
Build ID: d11313f341d1d9a9c73c736932441a89d5292e37
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3;   and gedit
Comment 2 Jean-Baptiste Faure 2018-07-21 19:59:52 UTC
No repro with Version: 6.0.5.2
Build ID: 1:6.0.5~rc2-0ubuntu0.16.04.1~lo1
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group threaded

Best regards. JBF
Comment 3 Alex Thurgood 2018-07-27 07:44:25 UTC
No repro with

Version: 6.0.5.2
Build ID: 54c8cbb85f300ac59db32fe8a675ff7683cd5a16
Threads CPU : 4; OS : Mac OS X 10.13.6; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group

and copy/pasting filtered content to TextWrangler text editor
Comment 4 Alex Thurgood 2018-07-27 07:48:29 UTC
Reproduced with

Version: 6.0.5.2
Build ID: 54c8cbb85f300ac59db32fe8a675ff7683cd5a16
Threads CPU : 4; OS : Mac OS X 10.13.6; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group


and

Apple Notes 4.5 (876.1)

Confirming that the behaviour is dependent on the target application.
Comment 5 Xisco Faulí 2018-07-30 10:05:17 UTC
Created attachment 143818 [details]
sample file
Comment 6 Xisco Faulí 2018-07-30 10:10:37 UTC
Reproduce it back to 

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 7 m_a_riosv 2019-06-06 16:40:51 UTC
*** Bug 125734 has been marked as a duplicate of this bug. ***
Comment 8 Timur 2021-04-23 12:28:22 UTC
Repro 7.2+ Windows with copy to MS Excel. (not to Notepad++).
Comment 9 m_a_riosv 2022-01-12 10:17:35 UTC
*** Bug 146709 has been marked as a duplicate of this bug. ***
Comment 10 Regina Henschel 2023-04-26 20:55:14 UTC
LibreOffice puts a lot of formats into the clipboard. Some of them have all rows, some of them exclude the filtered rows. It depends on the use case, what is the best suitable format.
In Excel you can select 'SYLK' or 'DIF' and you get all rows or you select 'HTML' and the filters rows are excluded, for example.
If the decision were to only use formats, which exclude the filters rows, would that really fit to all used cases?
Comment 11 flywire 2023-07-16 09:10:37 UTC
(In reply to Regina Henschel from comment #10)
> LibreOffice puts a lot of formats into the clipboard.

There is at least a documentation issue.
Comment 12 Gabor Kelemen (allotropia) 2024-12-12 10:10:54 UTC
I did some research with the example file about paste results:

Calc puts copied data to the clipboard in various formats, and some are filtered, some are not. External applications (even Writer) may or may not choose a filtered one by default.

Calc default paste: filtered.
Writer default paste: not filtered (result is a table)
Impress default paste: not filtered
Notepad default paste: filtered
Notepad++ default paste: filtered
Excel 16 default paste: not filtered
Word 16 default paste: filtered (result is a table)

Pasting in Writer with all the Paste special options, results in:

LO spreadsheet: filtered (result is OLE object)
DDE Link: unfiltered
HTML: filtered
Rich text formatting (RTF): unfiltered
Rich text formatting (Richtext): unfiltered
Unformatted text: filtered
Graphics Device Interface Metafile (GDI): filtered
Bitmap image: filtered

Pasting in Excel has some more options on top of these:
PNG: filtered
Unformatted text (TSV-Calc): filtered
Data Interchange Format (DIF): unfiltered 

For comparison, Excel -> Word (2016 in my case) paste supports the following formats:
Default: filtered
Special, Excel Worksheet Object: filtered
Special, RTF: filtered
Special, Unformatted text: filtered
Special, Bitmap: filtered
Special, EMF: filtered
Special, HTML: filtered
Special, Unformatted Unicode Text: filtered

So all in all, we may say that in case of spreadsheet to text editor it makes sense to change the relevant formats - in our case, RTF.

I'm unsure about the "DDE Link" format, may make sense to keep as-is, given it's kinda rarely used.

Another interesting comparison, Excel -> PowerPoint results in the following:
Default: filtered
Special: Excel Worksheet object: filtered 
Special: HTML: filtered 
Special: RTF: Filtered
Special: Unformatted text: filtered
Special: EMF: filtered
Special: WMF: filtered
Special: DIB: filtered
Special: Bitmap: Filtered

And Calc -> Impress: 
Default paste: unfiltered
Special: LO spreadsheet: filtered
Special: GDI: filtered
Special: BMP: Filtered
Special: HTML: crash (oops... I'll file a separate one for this)
Special: Unformatted: Filtered
Special: Rich Text Format (RTF): Unfiltered 
Special: Rich text formatting (Richtext): Unfiltered

(also why do we even need 2 RTF paste formats?)