Page 1 of 1

Code to find a cell contains image or pic

Posted: Fri Jan 11, 2019 9:12 am
by Nayan9245
Hi,

I have used a code to find the cell intersects with any image or picture or not . Can any one design a code to do the same in libre-office

Re: code to find a cell contains image or pic

Posted: Fri Jan 11, 2019 8:29 pm
by Lupp
Welcome to the community with your first post in this forum.

Cells never contain images. The images are added to the DrawPage of the respective spreadsheet. Calc itself doesn't worry much about the positional relations between images / shapes and cell areas. You would need to calculate a lot based on the API to get your intersection info. (You didn't clearly regard the difference between "contains" (within its area) and "intersects". Please clarify.)

Re: code to find a cell contains image or pic

Posted: Fri Jan 11, 2019 9:52 pm
by Zizi64
Maybe you can operate with the anchor and the aligning:

viewtopic.php?f=9&t=34544

Re: Code to find a cell contains image or pic

Posted: Fri Jan 11, 2019 11:11 pm
by Lupp
You may play with the attached erxample. It contains a few graphical elements and code intersecting their areas with the cell grid. The results are written into consecutive rows of columns A:C.
For any shape the rectangular hull is the effective area.
I did no research concerning hidden rows and columns or concerning merged cell areas. Have a lot of fun.