qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
17.64k stars 1.69k forks source link

Add new exported function `GetCellPixelsWithCoordinates` #1842

Open t4traw opened 3 months ago

t4traw commented 3 months ago

PR Details

Added GetCellPixelsWithCoordinates Function to Determine Cell Dimensions in Pixels

Related Issue

https://github.com/qax-os/excelize/issues/1813

Motivation and Context

To adjust the aspect ratio displayed in individual Excel cells, it is necessary to tweak ScaleX or ScaleY, but there isn't an appropriate public function available for this calculation. Although public functions like GetRowHeight and GetColWidth exist, they do not return values in pixels, and there's a discrepancy with the pixel calculations used within drawingResize in AddPicture. DrawingResize (using getRowHeight and getColWidth) seems to accurately calculate sizes for the most part.

-----GetRowHeight, GetColWidth-----
cellWidth:  306
cellHeight:  333
-----drawingResize(getRowHeight, getColWidth)-----
cellWidth:  360
cellHeight:  264

Therefore, the pixel function used in drawingResize has been extracted as a public function.

How Has This Been Tested

Types of changes

Checklist