Bug 45958 - Only Copy Visible Cells (after a filter) doesn't work when only unfiltered columns are selected
Summary: Only Copy Visible Cells (after a filter) doesn't work when only unfiltered co...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.4 release
Hardware: All All
: medium normal
Assignee: Roland Kurmann
URL:
Whiteboard: target:7.2.0
Keywords:
: 92125 (view as bug list)
Depends on:
Blocks: Cut-Copy Cell-Selection
  Show dependency treegraph
 
Reported: 2012-02-12 11:38 UTC by pirri
Modified: 2021-12-06 12:27 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
CALC example (9.55 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-02-12 11:38 UTC, pirri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pirri 2012-02-12 11:38:40 UTC
Created attachment 56922 [details]
CALC example

In the LibO online manual (http://help.libreoffice.org/Calc/Only_Copy_Visible_Cells) says : 

Cells were filtered by AutoFilters, standard filters or advanced filters. --> Only the visible cells of the selection are copied, deleted, moved, or formatted. 

This is not completly true, at least when you want to COPY data. 

Try this:

1. Open the attachment.
2. Filter the data (for example, by Country).
3. Edit-->Select all, then copy, then go to sheet 2 and paste the data. Only the visible cells are copied (as expected ).

Now, try this:

1. With the data still filtered, select column "Name" and then hold CTRL and select column "Salary"
2. Edit -> Copy, and then paste the date in the sheet 2.

As you can see, ALL cells are copied, not only the visible ones. The expected behavior should be copy the visible cells only (I think).
Comment 1 pirri 2012-02-12 12:16:38 UTC Comment hidden (obsolete)
Comment 2 Roman Eisele 2012-05-03 10:09:46 UTC Comment hidden (obsolete)
Comment 3 sasha.libreoffice 2012-05-17 06:32:50 UTC
Thanks for bugreport
reproduced in 3.3.4 and 3.5.3 on Fedora 64 bit

What is interesting: in 3.3.4 after apply filter, all rows except selected by filter are hidden (in msExcel 2007 the same). But in 3.5.3 not only rows selected by filter are shown, but also all empty rows.

Changing version to 3.3.4 as most early reproducible
Comment 4 Mirosław Zalewski 2013-08-16 21:33:33 UTC
@Kohei: could you take a look at this? Check if this qualifies as EasyHack and possibly give some code pointer for anyone interested in working on this?


It seems that "Copy only visible cells" feature is triggered only if filtered column is copied along.
Comment 5 QA Administrators 2015-04-01 14:41:37 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2015-04-23 18:48:01 UTC
Repro with attachment 56922 [details].

Win 7 Pro 64-bit Version: 5.0.0.0.alpha1+ (x64)
Build ID: f3375fa07f27bd2ade519af3c07d69040d10eaa9
TinderBox: Win-x86_64@42, Branch:master, Time: 2015-04-22_23:38:50
Locale: fi_FI
Comment 7 QA Administrators 2016-09-20 09:32:08 UTC Comment hidden (obsolete)
Comment 8 Mirosław Zalewski 2016-09-20 17:06:32 UTC
Reproduced on:
Version: 5.2.0.4
Build ID: 066b007f5ebcc236395c7d282ba488bca6720265
CPU Threads: 1; OS Version: Windows 6.2; UI Render: default; 
Locale: pl-PL (pl_PL)
Comment 9 UserBDF1011 2017-03-21 01:11:44 UTC
I have stumbled upon this nasty bug also on Calc version 5.2.5.1.
Some more info about it: it happens on ods and xls, so document type seems irrelevant.
I was copying rows, not columns but behavior is the same.

There is a catch how to avoid the bug with some extra steps, but most people will not do this in real life when using Calc.
When I open the document and just open filter combo box that effectively filters visible data, I just (re)click the filter to be exactly the same as it was originally and apply it (again). So it does not result in any visible changes. But then copy/paste works as expected.
Comment 10 Timur 2018-02-21 12:42:22 UTC
*** Bug 92125 has been marked as a duplicate of this bug. ***
Comment 11 QA Administrators 2019-07-11 02:54:01 UTC Comment hidden (obsolete)
Comment 12 b. 2020-08-01 20:20:04 UTC
still bug with: 

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 0d45380c99c7200075d01860a2315d0ddb450f1c
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL

exotic case, just few selection of columns fail, but should be fixed to produce quality ... 

while copying non-consecutive columns - as described in tdf#92125 - even including the filtered column fails
Comment 13 Roland Kurmann 2021-04-02 07:40:46 UTC
Reproduced

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 4f7bc49bce261f1cf206d25f0299fd080a9f5d28
CPU threads: 4; OS: Linux 5.3; UI render: default; VCL: x11
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 14 Roland Kurmann 2021-04-02 20:01:58 UTC
Taking
Comment 15 Roland Kurmann 2021-04-22 05:51:57 UTC
I've submitted a patch to gerrit: https://gerrit.libreoffice.org/c/core/+/114450

Waiting for review

Estimated, I've invested about 2-3 work weeks of my personal time for fixing and testing filtering/transposing pasting issues.
Comment 16 Commit Notification 2021-04-22 13:12:22 UTC
scito committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6491c205acb3c166d93ef6a41199d344e21d98ac

tdf#107348 tdf#45958 tdf#141215 tdf#141683 fix filtered/transpose paste

It will be available in 7.2.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.
Comment 17 Timur 2021-04-23 12:43:33 UTC
Looks good, I set Verified. 
Please see bug 118858.