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.
Created attachment 203810 [details] The example file in Excel and Calc side by side
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
Created attachment 205367 [details] different zoom levels on Excel Excel: Different zoom levels (190% vs 110%) has different text alignment under the image.
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%)
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?
Created attachment 205370 [details] Calc has wider image width
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.
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.
(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.
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.
(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.
Created attachment 205901 [details] image aligned to col H A) image overlap Calc vs Excel.