Bug 169332 - FILEOPEN XLSX Scaled images width is imported incorrectly
Summary: FILEOPEN XLSX Scaled images width is imported incorrectly
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xlsx
Depends on:
Blocks: XLSX-Images
  Show dependency treegraph
 
Reported: 2025-11-07 22:05 UTC by Gabor Kelemen (Collabora)
Modified: 2026-03-03 09:53 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Excel 2013 (20.20 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-11-07 22:05 UTC, Gabor Kelemen (Collabora)
Details
The example file in Excel and Calc side by side (131.77 KB, image/png)
2025-11-07 22:06 UTC, Gabor Kelemen (Collabora)
Details
different zoom levels on Excel (100.08 KB, image/png)
2026-02-04 22:35 UTC, Bayram Çiçek
Details
Excel, print preview in different zoom (106.07 KB, image/png)
2026-02-04 22:39 UTC, Bayram Çiçek
Details
texts does not match the columns (Excel vs Calc) (121.32 KB, image/png)
2026-02-04 22:45 UTC, Bayram Çiçek
Details
Calc has wider image width (154.20 KB, image/png)
2026-02-04 22:46 UTC, Bayram Çiçek
Details
xlsx document with text under the image (20.87 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2026-02-04 23:03 UTC, Bayram Çiçek
Details
image aligned to col H (34.57 KB, image/png)
2026-03-03 09:53 UTC, Bayram Çiçek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (Collabora) 2025-11-07 22:05:47 UTC
Created attachment 203809 [details]
Example file from Excel 2013

Attached simple file was made in Excel, inserting an image and scaling its height and width to a bit below 100%.

The height is imported correctly, but the width is slightly smaller than it should be.

1. Open attached example file
-> Notice the images width is 11,96 cm instead of the 12,09 cm indicated by Excel.

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 620(Build:0)
CPU threads: 16; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win
Locale: de-DE (hu_HU); UI: en-US
Calc: threaded

Same since 4.0, before it was a bit larger, but not correct still. Not recent, bibisect makes not much sense.
Comment 1 Gabor Kelemen (Collabora) 2025-11-07 22:06:08 UTC
Created attachment 203810 [details]
The example file in Excel and Calc side by side
Comment 2 jcline 2025-11-14 05:12:24 UTC
I can reproduce in Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 620(Build:0)
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 3 Bayram Çiçek 2026-02-04 22:35:52 UTC
Created attachment 205367 [details]
different zoom levels on Excel

Excel: Different zoom levels (190% vs 110%) has different text alignment under the image.
Comment 4 Bayram Çiçek 2026-02-04 22:39:44 UTC
Created attachment 205368 [details]
Excel, print preview in different zoom

Excel: on the workbook view, different zoom levels change the width of the image.
12.93cm (110%)  vs 12.86cm (120%)
Comment 5 Bayram Çiçek 2026-02-04 22:45:13 UTC
Created attachment 205369 [details]
texts does not match the columns (Excel vs Calc)

Excel vs Calc: Text under the image is not in the same place when opening in Calc. Can we say, Not only the image widths, but also the text widths are not the same in both applications?
Comment 6 Bayram Çiçek 2026-02-04 22:46:53 UTC
Created attachment 205370 [details]
Calc has wider image width
Comment 7 Bayram Çiçek 2026-02-04 23:03:25 UTC
Created attachment 205371 [details]
xlsx document with text under the image

Hi.

I've been working on this ticket for a few weeks. I didn't find any issues on the width calculation on the LO side. But column width of Excel and Calc seems different. (Caolan)
This seems the main reason why width of an image is different in both application. Image width sticks to the column location rather than its width.

I see excel itself has different calculations on the image widths. Some info about column widths:

```
Column width is not a pure point measurement. Instead, it’s based on the number of characters of the default font that can fit in the cell. For example, a column width of 8.43 means about 8 characters of the default font (Calibri, size 11) fit across the cell. Excel internally converts this into points for display, but it’s not a straight “height vs. width” comparison [...]
```

The attached document has some text underneath the image. I uploaded some screenshots to compare the documents in the previous comments.

- If I take the exact image width during import (avoiding changes in the codebase), and apply it to Calc -> the image position relative to columns will be wrong. 

- So, at the moment, we can't say "get the exact image width from Excel and make it the same width in Calc". -> position -related to columns- will be wrong.

Maybe this is just how it works? Is this really a bug? I'm not sure, and I'm confused here.

@Gabor: What is the expected outcome here? What behavior do you think is correct?

Thank you.
Comment 8 Caolán McNamara 2026-02-05 08:51:25 UTC
Can we get some images with the excel and calc grids, at the same zoom level with the sample image in them overlaid (50% transparency or so) on top of eachother to easily compare:

a) blank freshly created excel spreadsheet, default column width with the image in it, and the image width set so the right side of the image aligns with the right side of some column, e.g end of 'F'. And then the same loaded in calc, at 100% zoom.
b) blank freshly created excel spreadsheet, with the image in it, but column A stretched to the width of the image, so the image width fits in just one column where the image width reported is the same as the width the original testcase reports.
Comment 9 Caolán McNamara 2026-02-05 14:59:47 UTC
(In reply to Caolán McNamara from comment #8)
> Can we get some images with the excel and calc grids, at the same zoom level

At 100% zoom is best I think. On-screen comparison at 100% zoom and compare what are the actual rendered boundaries of the image. Lets assume, if they actually align then, regardless of what (fantasy) numbers the applications report, then it's in the right place and size.
Comment 10 Aron Budea 2026-02-25 17:01:53 UTC
I did find two interesting commits when looking for the change of 2.10 -> 2.07 in 5.3 when opening the first attachment (no roundtrip):
https://git.libreoffice.org/core/commit/f2a75fecdfb5d92d27074312f29dc7dc4afb16ec
author		Bartosz Kosiorek <gang65@poczta.onet.pl>	Mon Aug 08 01:13:05 2016 +0200
committer	Eike Rathke <erack@redhat.com>	Mon Dec 05 10:27:40 2016 +0000

"tdf#91475 Fix column width during .xlsx export"
(yes, this commit matters for import as well)

https://git.libreoffice.org/core/commit/16726a1b37df8bdcae02b3c7699df814977222bd
author		Markus Mohrhard <markus.mohrhard@googlemail.com>	Wed May 20 03:59:49 2015 +0200
committer	Markus Mohrhard <markus.mohrhard@googlemail.com>	Wed May 20 04:04:13 2015 +0200

"better algorithm for OOXML column width import, tdf#91267"

While they won't help much, maybe there's something to take away in there.
Comment 11 Bayram Çiçek 2026-03-03 09:50:56 UTC
(In reply to Caolán McNamara from comment #8)
> Can we get some images with the excel and calc grids, at the same zoom level
> with the sample image in them overlaid (50% transparency or so) on top of
> eachother to easily compare:
> 
> a) blank freshly created excel spreadsheet, default column width with the
> image in it, and the image width set so the right side of the image aligns
> with the right side of some column, e.g end of 'F'. And then the same loaded
> in calc, at 100% zoom.

A) Set width to a column. images does not match. -> Excel one is a bit wider.
Excel's col width is wider.

> b) blank freshly created excel spreadsheet, with the image in it, but column
> A stretched to the width of the image, so the image width fits in just one
> column where the image width reported is the same as the width the original
> testcase reports.

A) fit image to column A. images does not match. -> Excel one is a bit wider. -> But widths are the same in this case.

Calc's col A width is wider.
Comment 12 Bayram Çiçek 2026-03-03 09:53:41 UTC
Created attachment 205901 [details]
image aligned to col H

A) image overlap Calc vs Excel.