Code to find a cell contains image or pic

Discuss the spreadsheet application
Post Reply
Nayan9245
Posts: 1
Joined: Thu Jan 10, 2019 5:06 pm

Code to find a cell contains image or pic

Post 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
OpenOffice 3.1 on Windows Vista
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: code to find a cell contains image or pic

Post 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.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: code to find a cell contains image or pic

Post by Zizi64 »

Maybe you can operate with the anchor and the aligning:

viewtopic.php?f=9&t=34544
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Code to find a cell contains image or pic

Post 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.
Attachments
aoo96546GraphicIntersectCellRange_1.ods
(49.58 KiB) Downloaded 88 times
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply