Bug 107348 - Pasting transpose of filtered data pastes unfiltered data
Summary: Pasting transpose of filtered data pastes unfiltered data
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Roland Kurmann
Whiteboard: target:7.2.0
: 140979 (view as bug list)
Depends on:
Blocks: Paste-Special
  Show dependency treegraph
Reported: 2017-04-22 04:35 UTC by Mohith Manoj
Modified: 2021-05-09 09:16 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Paste transpose of filtered data (9.40 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-04-22 04:35 UTC, Mohith Manoj

Note You need to log in before you can comment on or make changes to this bug.
Description Mohith Manoj 2017-04-22 04:35:00 UTC
Created attachment 132745 [details]
Paste transpose of filtered data

1. Assume there is a table of data with auto-filter turned ON.
2. The table is then filtered based on a specific key.
3. The filtered table is copied.
4.a. Clipboard is pasted (into same or another ODS file) with only value and transpose option UNCHECKED.
4.b. Clipboard is pasted (into same of another ODS file) with only value and transpose option CHECKED.

Both steps 4.a and 4.b should result in the filtered data only getting pasted.

Actual result
1. At step 4.a the filtered data only is pasted (as expected).
2. At step 4.b the entire data is pasted (while transposing it of course)!
Comment 1 m_a_riosv 2017-04-22 14:24:53 UTC

*** This bug has been marked as a duplicate of bug 92125 ***
Comment 2 Timur 2018-02-21 12:58:16 UTC
Bug 92125 is a duplicate of Bug 45958 and they are about unfiltered columns. 
But that is not what's reported here with transpose so I'll set this one to New. 
I'll set to minor because result can be reached with 2 steps, first paste then transpose.
Comment 3 QA Administrators 2019-02-22 03:43:44 UTC Comment hidden (obsolete)
Comment 4 Mohith Manoj 2019-02-22 03:49:52 UTC Comment hidden (obsolete)
Comment 5 Roland Kurmann 2021-01-28 19:02:43 UTC
Reproduced in

Build ID: 00(Build:2)
CPU threads: 4; OS: Linux 5.3; UI render: GL; VCL: kf5
Locale: de-CH (en_US.UTF-8); UI: de-DE
Calc: threaded
Comment 6 Timur 2021-03-12 17:36:21 UTC
*** Bug 140979 has been marked as a duplicate of this bug. ***
Comment 7 burnuser2 2021-03-13 06:34:25 UTC
The bug is open/known since 2017, ... are there any plans to resolve it in the foreseeable future?
Comment 8 Roland Kurmann 2021-03-13 07:12:20 UTC
> The bug is open/known since 2017, ... are there any plans to resolve it in the foreseeable future?

Yeah, I'm working on it. Until now, I've debugged the code and I have an idea how to fix it.
Actually, it seems to me this case was never implemented. It is just missing.
But it is complicated code and I have to be careful not to break anything else.
Disclaimer: I'm an ordinary LibreOffice user. (I've already spent to about two days on it. I expect two more days are necessary.)
Comment 9 Roland Kurmann 2021-03-21 10:06:57 UTC

The proof of concept was successful. It is fixed in one case. I'm working now on all the other cases and write unit tests.
Comment 10 Roland Kurmann 2021-03-30 18:19:09 UTC
The main implementation is done. I've implemented it in a test-driven approach (first write the test, then the implementation).

There are more cases to handle than expected. The following cases are working:

* Different cell types: numbers, strings, formulas, rich text, empty cell
* Filtered transposed cells are selected
* Notes
* Formula references to rows before and after filtered row
* Double reference (e.g. A1:A3)
* Relative and absolute formula references
* Reference to filtered row (#REF!)
* Formatting patterns (e.g. cell backgrounds and borders)

Next I'll test manually and polish the code. Afterwards, I'll submit the code.
Comment 11 Roland Kurmann 2021-04-22 05:51:34 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 12 Commit Notification 2021-04-22 13:12:11 UTC
scito committed a patch related to this issue.
It has been pushed to "master":


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:

Affected users are encouraged to test the fix and report feedback.
Comment 13 BogdanB 2021-05-08 00:12:19 UTC
I'm impressed by your unit tests in yor code, scito. I will try to verify this bug in the next 2 days.
Comment 14 Roland Kurmann 2021-05-08 07:02:32 UTC
(In reply to BogdanB from comment #13)
> I'm impressed by your unit tests in yor code, scito.

I've tried to catch all cases.

> I will try to verify this bug in the next 2 days.


Currently, I'm working on cut transpose issues (bug 68976, bug 142065, bug 71058). I'll reuse the unit test setup and slightly enhance it for cut. It is really helpful. Probably next weekend, I'll submit a patch for the cut issues.
Comment 15 BogdanB 2021-05-09 09:16:17 UTC
Verified. Working well in
Version: / LibreOffice Community
Build ID: 1a99b4e44190e182d56a04678850d62635d74c65
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded