Bug 147420 - Images anchored to a cell and selected with AUTOFILTER are not displaying or PRINTING correctly
Summary: Images anchored to a cell and selected with AUTOFILTER are not displaying or ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
: 151129 (view as bug list)
Depends on:
Blocks: AutoFilter Print
  Show dependency treegraph
Reported: 2022-02-14 15:27 UTC by Graham Tapper
Modified: 2024-03-26 04:34 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:

Selection data as it *should* appear (182.84 KB, application/pdf)
2022-02-14 15:36 UTC, Graham Tapper
Selection data as it actually appears (247.09 KB, application/pdf)
2022-02-14 15:39 UTC, Graham Tapper
Copy of problematic spreadsheet (1.69 MB, application/vnd.oasis.opendocument.spreadsheet)
2022-02-21 17:04 UTC, Graham Tapper

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Tapper 2022-02-14 15:27:14 UTC
I have created a spreadsheet with multiple rows that can be selected together from a single criteria, based on data in a single column, to produce a printable page.  The purpose is to be able to print different pages from the same sheet simply by using different filter criteria selections.

When you start from all filter criteria selected, all rows showing, and then deselect all criteria and then select a single criteria, the rows presented are correct.  

If you then deselect that criteria and then select a different criteria, without first again selecting *all* criteria, the rows are not all selected correctly.

The problem seems to revolve around rows that contain a cell with an anchored image.  Either the image that is selected is that which was associated with the previous criteria or else both new and old images are selected, one on top of the other.  All other rows seem correctly selected.

Autofilter incorrectly selecting images anchored to cells on adjacent rows was a problem I reported a couple of years ago.  That seemed to have been fixed but maybe this shows it hasn't been entirely fixed?

Steps to Reproduce:
1. Deselect all selection criteria from the selection column
2. Select the desired criteria and press OK
3. Rows selected are correct
4. Deselect the selected criteria
5. Select a new criteria and press OK
6. Rows selected are not all correct.  A Row containing an anchored image appears not to have "forgotten" the image previously selected
7. Deselect the new criteria and select *all* criteria and press OK
8. Deselect *all* criteria and once again select the new criteria.  This time the rows are presented correctly

Actual Results:
If a new criteria is selected immediately after deselecting an old criteria, the incorrect image is presented

Expected Results:
I would expect the rows to be correctly selected without first having to go through the additional requirement to reselect *all* criteria first

Reproducible: Always

User Profile Reset: No

Additional Info:
I can't find anything relevant in the Help.  Everything else is working as expected.  The problem seems solely to do with cells containing anchored images, and the action of criteria selection from an Autofilter drop-down list
Comment 1 Graham Tapper 2022-02-14 15:36:24 UTC
Created attachment 178270 [details]
Selection data as it *should* appear

This shows the selected data when the selection criteria is selected after all criteria have first been selected
Comment 2 Graham Tapper 2022-02-14 15:39:08 UTC
Created attachment 178271 [details]
Selection data as it actually appears

This shows how the selected data appears when a criteria is selected directly after another criteria has been deselected, without first going through the action of reselecting all criteria.  Note that two images anchored to two different cells appear in top of one another.
Comment 3 m_a_riosv 2022-02-14 18:51:42 UTC
Where are your sample spreadsheet, attached pdf doesn't help to look for the issue.
Comment 4 Graham Tapper 2022-02-21 17:04:02 UTC
Created attachment 178446 [details]
Copy of problematic spreadsheet

This is a copy of the spreadsheet, with personal information removed.  The problem is with the Cover_Sheets sheet.  Just a reminder of the problem:

1) In the column "Walks", in the drop-down box, unclick "All"
2) Select a criterion from the list, for example, "Amber Hill", Click "OK"
3) Click on "File > Print Preview" from the main menu. The print layout looks like the selection criteria page, as it should.
4) Now print the page.  The problem will not occur unless the page is actually printed.
5) Now deselect the criterion and select a different criterion. Click "OK".
6) Click on "File > Print Preview".  You will see that the print image now contains two maps printed one on top of the other.  
7) Print the page and the printed page will also have two maps printed one on top of the other.
8) Now select "All" from the drop-down list and click "OK".
9) Then deselect "All" and select another criteria. Click "OK".
10) Click on "File > Print Preview" from the main menu. The print layout looks like the selection criteria page, as it should.
11) Print the page and it prints correctly again!

It all seems to be something to do with the actual print process.  For some reason the last map used gets left in the "buffer" and applied to the next selection, so as to give two maps instead of just one!
Comment 5 m_a_riosv 2022-02-21 22:11:48 UTC
Seems something i is wrong, at point 7, preview is OK, but print has the previous image.
"All" doesn't have an image.
Version: (x64) / LibreOffice Community
Build ID: 349cd3ad57dce98d6b54b76f8e9f456ac7d7edb7
CPU threads: 4; OS: Windows 10.0 Build 21390; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL
Comment 6 Graham Tapper 2022-02-22 12:41:05 UTC
Yes, correct, "All" is not associated with any particular criteria but is merely provided by LibreOffice as the default to show all rows. "All" would never be used in practice to print a cover sheet.  "All" is there to provide an overall view of all of the entries on that sheet, so that changes can be made.

A print of a cover sheet will only ever be for a single criterion.  Consequently, the print of the cover sheet should only ever contain one map.

Just so that you know, if you weren't yourself involved, I reported a problem in the same area, a couple of years ago, when I discovered that a print of a cover sheet for a single criteria, included *all* of the maps!!!  That was resolved, I thought, in this release, but it seems that it isn't yet quite sorted!

This is a very bizarre bug.  I suspect that I may be the only person experiencing it.  However, for my usage of LibreOffice, correct functioning of this ability is essential
Comment 7 Graham Tapper 2022-03-03 20:03:13 UTC
I have just realised that we are getting mixed up over the use of "All".  My apologies.  I didn't mean the "All" criteria; I meant the "All" box right at the top of the list, that selects All criteria.  Realising the confusion, I have changed the criteria name to "*Headings" on my copy of the spreadsheet, just so as to differentiate the usage of the term "All"
Comment 8 m_a_riosv 2022-12-21 14:35:32 UTC
*** Bug 152635 has been marked as a duplicate of this bug. ***
Comment 9 m_a_riosv 2024-03-24 10:20:23 UTC
*** Bug 160329 has been marked as a duplicate of this bug. ***
Comment 10 Telesto 2024-03-24 20:39:27 UTC
*** Bug 152635 has been marked as a duplicate of this bug. ***
Comment 11 Telesto 2024-03-24 20:47:47 UTC
This is quite a nasty bug,IMHO Based on my testing at bug 160329; it appears to be permanent. There might also cases where it can be triggered without auto filter involved (bug 160231).
Comment 12 Stéphane Guillou (stragu) 2024-03-25 00:54:21 UTC
Thanks for the heads up.
Reproduced on Linux as well with:

Version: (X86_64) / LibreOffice Community
Build ID: 359ef544e625d2ffbfced462ab37bd593ca85fa7
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

My short steps:
1. open attachment 178446 [details]
2. In sheet Cover_Sheets, filter Walks column for Azalea only
3. In same AutoFilter dropdown, untick Azalea and tick Buttermere
4. Ctrl + P to see the in-dialog preview

Result: overlapped images, or only previous image shown. Does not match File > Print Preview nor canvas.
I reproduce the mismatch since 6.1.

In, the first filter would already show two images instead of 1, but the canvas would match the print preview and the print dialog.

Will bibisect that change.
Comment 13 Stéphane Guillou (stragu) 2024-03-25 11:58:12 UTC
Bibisected some changes:

- before 6.1: result of first filter is a jumble of pictures, but the canvas, print preview and print dialog all match.

- linux-64-6.1, build [a25fe0dc4460c3dec74d8590c036c6892b95bd06], commit 4f29ce6a67b81e7f28e1c86d60ff15ec1d180661: result of first filter is a single picture, but print dialog still has a jumble of pictures.

commit 4f29ce6a67b81e7f28e1c86d60ff15ec1d180661
author	Samuel Mehrbrodt 	Tue Feb 27 16:56:44 2018 +0100
committer	Eike Rathke 	Tue Mar 13 00:23:40 2018 +0100
tdf#114552 Improve image scaling in Calc
Reviewed-on: https://gerrit.libreoffice.org/50451

- linux-64-7.1, build [25b3c957bfcb95a1da27a6021d1514495fd7df51], commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca: result of first filter is a single picture, and matches the print dialog. However, result of the _second_ filter still creates a mismatch (shows the previous picture in the print dialog).

commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca
author	Regina Henschel 	Sat Oct 10 17:55:31 2020 +0200
committer	Regina Henschel 	Sat Oct 31 15:36:00 2020 +0100
Improve 'resize with cell' handling
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104643

Samuel and Regina, any chance you could have a look at this?

(Reports marked as duplicate would have to be checked, as we're focusing on the printing aspect here.)
Comment 14 Stéphane Guillou (stragu) 2024-03-25 11:59:01 UTC
*** Bug 151129 has been marked as a duplicate of this bug. ***
Comment 15 Stéphane Guillou (stragu) 2024-03-25 13:37:22 UTC
(In reply to Stéphane Guillou (stragu) from comment #13)
> (Reports marked as duplicate would have to be checked, as we're focusing on
> the printing aspect here.)