You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I add an image to an existing spreadsheet (a png in my case) whose size perfectly matches the size (in cm) of the area in which I want it to display, it gets displayed scaled/displayed incorrectly (too small).
I think the calculation for to.col & to.row calculated in positionObjectPixels is somehow going wrong when using the col/row dimensions or image dimensions.
I also think that if there was an option to use <xdr:oneCellAnchor>see here it may fix the image display by avoiding having to do the calculations.
Steps to reproduce the issue:
Create an existing 'template' spreadsheet in excel with the first 8 column widths sized as follows (to hold the image): a=1.38cm, b=19.39, c=1.14, d=1.11, e=1.11, f=1.11, g=2.94, h=4.42 (total 31.6cm) / or as Excel prefers to measure them A=6.29, B=98.86, c=5.14, d=5, e=5, f=5, g=14.43, h=22
Use func (*File) AddPicture ...with the aspect ratio locked, no offset, no link and scaling set to 1 (I have also tried without these) to insert a png of size 10.64cm high and 30.96 wide
Describe the results you received:
The image is inserted constrained to the width of 3 cols (a, b, c).
It's aspect ratio is wrong.
In Excel, going to the image size properties and choosing 'Reset' scales it as it should be (to 100% scale and col H)
Describe the results you expected:
The image is inserted constrained within the width of 8 cols (a, b, c, d, e, f, g, h).
It's aspect ratio should be maintained.
In Excel, going to the image size properties should show it scaled to 100%
Thanks, do you think this (<xdr:oneCellAnchor>) is the only way to get the image to display at it's intended size?
Do you have any idea why the to.col & to.row calculated in positionObjectPixels is somehow going wrong for the existing <xdr:twoCellAnchor> implementation? I had a look but couldn't see anything obvious.
Excel use EMUs (English Metric Units) to measure image offset and used to determine the location of the picture, this value is affected by different screen resolutions and can‘t be accurately calculated, so if the generated image size doesn't meet expectations, you need to set the offset manually. Reference English Metric Units and Open XML.
Description
When I add an image to an existing spreadsheet (a png in my case) whose size perfectly matches the size (in cm) of the area in which I want it to display, it gets displayed scaled/displayed incorrectly (too small).
I think the calculation for
to.col
&to.row
calculated in positionObjectPixels is somehow going wrong when using the col/row dimensions or image dimensions.I also think that if there was an option to use
<xdr:oneCellAnchor>
see here it may fix the image display by avoiding having to do the calculations.Steps to reproduce the issue:
a=1.38cm, b=19.39, c=1.14, d=1.11, e=1.11, f=1.11, g=2.94, h=4.42 (total 31.6cm)
/ or as Excel prefers to measure themA=6.29, B=98.86, c=5.14, d=5, e=5, f=5, g=14.43, h=22
func (*File) AddPicture
...with the aspect ratio locked, no offset, no link and scaling set to 1 (I have also tried without these) to insert a png of size10.64cm high and 30.96 wide
Describe the results you received:
Describe the results you expected:
Output of
go version
:go1.10
Excelize version or commit ID:
1.2.0
Environment details (OS, Microsoft Excel™ version, physical, etc.):
OS. Win 10 & MacOS 10.13, physical, Excel 1708 & earlier
The text was updated successfully, but these errors were encountered: