Bug 145054 - FILEOPEN XLSX Copying a sheet with autofilter by color leaves unusable autofilter on the copy sheet
Summary: FILEOPEN XLSX Copying a sheet with autofilter by color leaves unusable autofi...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Samuel Mehrbrodt (allotropia)
URL:
Whiteboard: target:7.4.0 target:7.5.0 target:7.4....
Keywords: filter:xlsx, implementationError
: 59312 (view as bug list)
Depends on:
Blocks: AutoFilter-Color
  Show dependency treegraph
 
Reported: 2021-10-11 06:34 UTC by Gabor Kelemen (allotropia)
Modified: 2022-10-06 08:11 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of the original sheet in Calc (59.58 KB, image/png)
2021-10-11 06:34 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the problem in the copy sheet (61.25 KB, image/png)
2021-10-11 06:34 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2021-10-11 06:34:10 UTC
Created attachment 175630 [details]
Screenshot of the original sheet in Calc

When an autofilter uses color filtering and the sheet is copied, the new sheet has the same autofilter but it is unusable.
This does not happen when an ODS file is autofiltered by color and the sheet is copied, for example in attachment 172482 [details] from bug 142578 this works fine.

Steps to reproduce:
    1. Open attachment 173243 [details] from bug 143104
    2. Sheet – Move or copy sheet
    3. Make a copy of Sheet1 in the same spreadsheet
    4. Try to open the autofilter on the newly created sheet

Actual results:
Autofilter does not work on the second sheet.

Expected results:
The autofilter should work properly on the second sheet too.

LibreOffice details:
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: b1488cd6f008049a9aaff7350deeb73cbbd535b6
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: hu-HU (en_US); UI: en-US
Calc: threaded
Comment 1 Gabor Kelemen (allotropia) 2021-10-11 06:34:28 UTC
Created attachment 175631 [details]
Screenshot of the problem in the copy sheet
Comment 2 Xisco Faulí 2021-10-22 09:29:33 UTC
Reproduced in

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: ea65215855462e5e48f7a3a78724c38b5fc0e4d1
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 3 Samuel Mehrbrodt (allotropia) 2021-12-15 09:53:39 UTC
This fails in https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/autofilterbuffer.cxx?r=f528fff9#869-872

Interestingly, this does work with most XLSX files where the <autoFilter> element is in /xl/worksheets/sheet1.xml in the xlsx file.
In this case, the autofilter is defined in xl/tables/table1.xml.

The <table> Element there looks like this:
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="__Anonymous_Sheet_DB__0" displayName="__Anonymous_Sheet_DB__0" ref="A1:C11" totalsRowShown="0">

Might be a problem that the __Anonymous_Sheet_DB__0 range is not properly imported here?
Comment 4 Gabor Kelemen (allotropia) 2021-12-15 10:06:49 UTC
(In reply to Samuel Mehrbrodt (allotropia) from comment #3)
> Might be a problem that the __Anonymous_Sheet_DB__0 range is not properly
> imported here?

Table (Database range in Calc terminology) is always wacky in relation to autofiltering: see bug 59312 or bug 117346.
Comment 5 Commit Notification 2022-01-27 06:33:50 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d9472a5284fde7bb96823655efcb6eb31f405493

tdf#145054 Copy named DBs too when copying sheet

It will be available in 7.4.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 6 Samuel Mehrbrodt (allotropia) 2022-01-27 08:09:12 UTC
*** Bug 59312 has been marked as a duplicate of this bug. ***
Comment 7 Samuel Mehrbrodt (allotropia) 2022-02-09 07:43:53 UTC
Follow up fixes:

commit 26d7f3440a0c9dd179ad407d48ce747699d678dd
Author: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Date:   Thu Jan 27 09:05:35 2022 +0100

    Fix copying named DB when it doesn't contain a '_'


commit 690e4852809ea21b5fd909298c5fa2a053fa0458
Author: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Date:   Mon Jan 31 09:02:33 2022 +0100

    Fix copying range when it doesn't contain a number
Comment 8 Commit Notification 2022-09-28 22:43:15 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/48b9cbc742de3f6120986cb6cafc92eb5009da82

Fix incrementing number in dbrange names during copying, tdf#145054 follow-up

It will be available in 7.5.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 9 Commit Notification 2022-10-01 07:50:11 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/9c0a3206d8eec4076f72448585efd027399697ae

Fix incrementing number in dbrange names during copying, tdf#145054 follow-up

It will be available in 7.4.3.

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 10 Commit Notification 2022-10-06 08:11:53 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4-2":

https://git.libreoffice.org/core/commit/253354e829777d0667c44d6da8e2ed71f894b89c

Fix incrementing number in dbrange names during copying, tdf#145054 follow-up

It will be available in 7.4.2.

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.