Ask Your Question
0

Macro to load an image into an imagecontrol in Calc

asked 2018-04-21 22:48:05 +0100

hvankampen gravatar image

updated 2018-04-22 23:14:23 +0100

David gravatar image

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.

edit retag flag offensive close merge delete

Comments

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.

David gravatar imageDavid ( 2018-04-22 22:06:31 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-04-22 05:55:42 +0100

Ratslinger gravatar image

Hello,

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.

edit flag offensive delete link more

Comments

Thankyou, This is what I needed.

hvankampen gravatar imagehvankampen ( 2018-04-22 20:50:12 +0100 )edit
2

@hvankampen: For accepting an answer a click on the checkmark left of it is the appropriate means.

Lupp gravatar imageLupp ( 2018-04-22 21:48:26 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-04-21 22:48:05 +0100

Seen: 260 times

Last updated: Apr 22 '18