Open rolinger opened 2 years ago
The distinction is between "one-cell anchor" (object moves with the anchor cell) and "two-cell anchor" (object will be moved and/or resized when the cells between the starting and ending anchors are moved or resized). So the two-cell anchor will resize with the cell, which is why it is legitimate for the start (setCoordinates) and end (setCoordinates2) coordinates to be the same. (Note that two-cell anchor can specify "one-cell" as an EditAs attribute, so may act like a one-cell anchor in that case.)
I created sample 48 as a playground for observing how the different anchor settings affect the behavior of the images. Note that there is also absolute positioning to consider. Play around with it to see if it answers your questions or raises new ones. Feel free to suggest (or, even better, submit as a PR) anything that would add clarity to the sample or the documentation. I do not know offhand the answers to a few of your questions (what would setOffsetX/Y do, how to get scaled size).
I am taking notes on more than a handful of methods and how they work so I can add notes to the documentation. A lot of the documentation reads like a definition of a word where the word itself is used in the definition. I hope to provide some clarity where I can.
This is:
For drawings, could you please clarify what setCoordinate() and setCoordinates2() are? Same for setOffsetX/Y and setOffsetX2/Y2? I am confused by duplication of these methods?
The docs don't tell what each is. And in the example scripts I see
setCoordinates('C9')
followed bysetCoordinates2('C9')
- at first I thought they were top/bottomX1('C9') & X2('C15')
or left/rightY1('H9') & Y2('H15')
- but being set to the same value doesn't make sense.In this example: https://github.com/PHPOffice/PhpSpreadsheet/blob/master/samples/Basic/48_Image_move_size_with_cells.php
For getImageWidth/getImageHeight, this appears to be the raw image sizes, what about getting the scaled image sizes?
What features do you think are causing the issue
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 1.24.1