Macro to load graphic into an image control

I have a writer document with an image control on it and I want to use a macro to load an image into it.
Hello,

Using the MRI tool add-on and inspecting the image control, I see a property called imageURL. I set this to a path to an image, but the image did not display.

I also see a property called Graphic, which almost corresponds to the property you can access from the user interface’s ‘Control Properties’ called ‘Graphics’…note that it is plural there. This is of a type XGraphic, however, and I’m not sure how to create an instance of this and associate it with the control.

So, in summary, given a path such as, C:\images\myImage.jpg , how do I load the image data from that file into an Image Control on a writer document using LO Basic?

Thank you!

Keith

Hello,

This appears to be an amendment to Mysql ODBC and XROW. Please do not start new questions for this purpose. Instead edit the original question adding the information there and noting that it is additional information.

Then please delete this post.

@Ratslinger
While true, I think that this is still relevant to those that want to accomplish a similar task, without muddling through ramblings about database code.

I plan on answering the other as well to help others who are searching for something similar.
Note that I changed my approach in the database related post.

Got it!
Referencing code from [Solved] How to insert an image into footer of Calc? (View topic) • Apache OpenOffice Community Forum
The property ImageURL doesn’t just take a path like C:\images\myImage.jpg
You have to format your path as a URL or, easier still, call convertToURL() on your path and assign it to the ImageURL property…Done!
For reference, the URL is formatted like: file:///C:/images/myImage.jpg
Also, if there are any spaces, they are converted to the HTML entity, ‘%20’

Hope this helps someone!
Keith