I am trying to use a basic macro to load and display an image in an imagecontrol in a calc dialog. I can get the file name of the file I want to load, but I cannot seem to find how to get the imagecontrol to load a file via a macro. Any help would be appreciated.
Please don’t close questions like that: others may have a different solution or approach to contribute. You indicate a question is “solved” by clicking the checkmark symbol next to the correct answer. Thanks.
Here is the basic code:
sURL = ConvertToURL("LOCATION_OF_IMAGE") oDialog1 = CreateUnoDialog( DialogLibraries.Standard.YOUR_DIALOG) oModel = oDialog1.getModel() oObj1 = oModel.getByName("NAME_OF_IMAGE_CONTROL") oObj1.ImageURL = sURL oDialog1.execute()
Just need to change image location, dialog name & name of image control.
Thankyou, This is what I needed.
@hvankampen: For accepting an answer a click on the checkmark left of it is the appropriate means.
in the first line for “LOCATION_OF_IMAGE” would I put “image1” if that is the name of the image in the calc sheet? I have
sURL = ConvertToURL(image1)
oDialog1 = CreateUnoDialog(DialogLibraries.Standard.Dialog_I_made)
oModel = oDialog1.getModel()
oObj1 = oModel.getByName(image1)
rem This line generates the error message
rem "Type: com.sun.star.container.NoSuchElementException
rem Message: "
I have no idea what “NAME_OF_IMAGE_CONTROL” is.
You have been directed here through an answer for a question you asked. Please do not start asking questions here. This will never resolve the other question if others are seeking a similar answer. These comments should be presented under the answer there and simply refer to this link.