Bug 167450 - With ODF version "1.2 extended (compatibility mode)", moving a sheet from an ODS file to another, causes the images to move
Summary: With ODF version "1.2 extended (compatibility mode)", moving a sheet from an ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0 target:25.8.0.2 target:...
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-07-10 10:33 UTC by ajperez81
Modified: 2025-07-22 12:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Original file to reproduce the bug (28.63 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-07-11 06:25 UTC, ajperez81
Details
File showing the bug result (26.64 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-07-11 06:26 UTC, ajperez81
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ajperez81 2025-07-10 10:33:45 UTC
Description:
Calc has an option to "Move or copy sheet" from an ODS file to another. Doing so should result in the exact same sheet, with no changes at all, just moved from one document to another. However, there is a bug causing the images to change their position, when using the ODF format version "1.2 Extended (compatibility mode)".

The issue did NOT happen in Calc version 7.5.9.2. It probably was introduced somewhere in the 7.6 branch, because it can be reproduced in Calc 7.6.7.2, and in every version since then up to the latest 25.2.4.3.

It does NOT reproduce in Calc 25.2.4.3 with ODF format version to "1.4 Extended (recommended)".

Steps to Reproduce:
1. In Calc, go to Tools > Options... > Load/Save > General, and change the "ODF format version" value to "1.2 Extended (compatibility mode)".
2. Create a new blank ODS file and save it as "first.ods".
3. Create a second new blank ODS file, and on it:
4. Increase the width of column A (by dragging the column header separator). For the bug to be more noticeable, make the column at least double its original width.
5. Copy any image (or take a screenshot), click on cell B1, and paste the image.
6. Right click the image and make sure it has selected "Anchor > To cell" (it's the default option anyway).
7. Right click the "Sheet1" in the tabs bar, and select "Move or copy sheet...".
8. In the popup window, select "first.ods" and press "Copy".
9. Go back to the "first.ods" file, save it, close it, and reopen it.
10. Switch to the "Sheet1_2" tab. The image should be in the cell B1, but it's instead in the middle of A1.

Actual Results:
In the moved or copied sheet, the images lose their position.

Expected Results:
The moved or copied sheet should be identical to the original one.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: threaded
Comment 1 m_a_riosv 2025-07-10 19:34:32 UTC
Please attach a sample file, reduce the size as much as possible without private information.
Comment 2 ajperez81 2025-07-11 06:25:19 UTC
Created attachment 201745 [details]
Original file to reproduce the bug
Comment 3 ajperez81 2025-07-11 06:26:01 UTC
Created attachment 201746 [details]
File showing the bug result
Comment 4 ajperez81 2025-07-11 06:32:45 UTC
I've attached two files, the first one with the source sheet, the second, with the result once that sheet has been moved to another ODS file (and the image has lost its position).

While creating the demo files, I've noticed that I missed an extra necessary condition in the original bug report. Step 8 should read:

8. In the popup window, select "first.ods", *choose "- move to end position -"*, and press "Copy".

If you move the sheet to the first position of the target document, the bug won't reproduce. If you move it to the end, or to any other position, it will. So at least there is a workaround for it.
Comment 5 m_a_riosv 2025-07-11 14:06:32 UTC
I'm not able to reproduce the issue.
Version: 25.2.5.1 (X86_64) / LibreOffice Community
Build ID: 484541f705153d4ff78284873b0153c3e5a280db
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded

Please test in safe mode, Menu/Help/Restart in Safe Mode
Comment 6 raal 2025-07-12 05:15:10 UTC
I can confirm with Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 20667acbca5df17771a3581632a672d5db4e751b
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

but not in Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: cs-CZ
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.10
Calc: threaded
Comment 7 raal 2025-07-12 05:34:05 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-7.6.
Adding Cc: to Regina Henschel ; Could you possibly take a look at this one?
Thanks
 f47c42c95293d2a888e8fc1ac1aeda33f9d44852 is the first bad commit
commit f47c42c95293d2a888e8fc1ac1aeda33f9d44852
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Sun Oct 29 07:52:53 2023 +0100

    source 800f9233513a45aa8f8950cf929fd44cb9381d72

151717: tdf#154821 improve shape export with hidden row/col | https://gerrit.libreoffice.org/c/core/+/151717
Comment 8 Regina Henschel 2025-07-12 15:00:34 UTC
After you have copied the sheet go to that sheet in the target document. You will notice, that the image is not rendered at the correct the position. Use the Navigator to select the image. Go back to the other sheet. Then again go to the newly inserted sheet again. Now the image should be rendered at the correct position. When you then save the target file and reload it, the image is an the correct position. If you do not make such manually refresh, the image gets a wrong position when saved.

This happens in save format ODF 1.4 extended as well.

So it seems, that the image in the target document needs some kind of refresh after the sheet is inserted.

Tested with Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b99f595b47d1a60e6af6ba742665a92803b7c68b
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded
Comment 9 Regina Henschel 2025-07-13 13:30:02 UTC
A patch is in https://gerrit.libreoffice.org/c/core/+/187802.
The patch misses a unit test yet, but should solve the problem.
Comment 10 Commit Notification 2025-07-15 14:34:30 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/704dd0d279af6c1ace1bde61fec93e7c3a8d1035

tdf#167450 adapt sheet index in anchor to new pos

It will be available in 26.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 11 Commit Notification 2025-07-15 15:42:43 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/054b38fd2eecc3279f117d34bd976f5dfc1a3883

tdf#167450 adapt sheet index in anchor to new pos

It will be available in 25.8.0.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.
Comment 12 Commit Notification 2025-07-22 12:07:34 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/30fcd4961299f640f3294d2b6bf6b7d76898921b

tdf#167450 adapt sheet index in anchor to new pos

It will be available in 25.2.6.

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.