-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddPicture Method Not Respecting AutoFit and LockAspectRatio in GraphicOptions #1536
Comments
I have encountered the same problem too.
I suspect I set the A1 cell to 300x300 px in Excel and ran go version:
excelize version:
os:
excel:
|
Hi @t4traw, thanks for your issue. I have tested with your code and it seems works well. Could you provide the base.xlsx and 400x300.jpg as a attachments? |
Hi @yamato1413, thanks for your feedback. The problem as your mentions was related to the issues #260, #279, #569 and #1419. |
@xuri Thank you for response! I'm sending a zip of the code tested in my environment along with the output results (also, I've created a repository for it https://github.com/t4traw/excelize_addPicture_sample). |
Thanks for your feedback. I have fixed this issue, please try to upgrade the master branch code, and this patch will be released in the next version. |
@xuri Thank you! I'm looking forward to the v2.8.0! |
@xuri I immediately tried out the commit contents of the master branch! It seems better than before, but it still appears the scale value is off. I've attached the re-output results as a zip file. |
Thanks for your feedback. I changed the default point to the pixels conversion factor for a better scale effect. But we still can't get the exact scaling percentage, related to I replies in issue #569, the image scaling depends on each row's height and column's width, these storage inner workbook files with pt units, we need to covert it into pixels, since this conversion was effected by device DPI, so we can't be made the conversion result fit any devices. As you open the same workbook with an image in a difference spreadsheet application, operation system, or client device, the size of an image may be different, so please adjust the scale by image options as you need. |
…sheet format property
… pixels conversion factor
…sheet format property
… pixels conversion factor
Description
I'm experiencing an issue with the
AddPicture
method in theexcelize
package. Despite settingAutoFit
totrue
andLockAspectRatio
totrue
inGraphicOptions
, it seems that the aspect ratio is only respected in the vertical direction, not in the horizontal direction. As a result, the images are distorted and do not fit correctly within the cells.Here's the relevant part of my code:
Describe the results you received:
file: base.xlsx
file: output.xlsx
Output of
go version
:Excelize version or commit ID:
Environment details (OS, Microsoft Excel™ version, physical, etc.):
Any help on this issue would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: