Here’s my problem. I insert an image into my Writer document so that it’s embedded, not linked. (If you rename the document with a .zip extension then open it, you’ll find the image in a folder named Pictures with a name like:
Now, what I do is hide this image in a hidden and password protected Section. The thing that I want to do now is get access to this image so that I can display it on a dialog. The thing is, I want to display this image only when you click on an empty image control which invokes an event and calls a Sub something like this:
Sub ImgPressed(oEvent as Object) ... oEvent.source.model.imageURL = "Pictures/100000010000001D0000001D6CBAE1108AA1FCB1.gif" ... End Sub
This does not work. I did a bit of searching and found this:
In addition to the normal protocols like file:// or http:// you can use private URLs as follows to get access to graphics lying inside the graphicrepository system within an Office context:
Note: As of LibreOffice 6.1 GraphicObject scheme URLs are not supported anymore. For example:
So it would seem that you used to be able to do this using “vnd.sun.star.GraphicObject: …”. In the quoted pie above, it says you can now use “private:graphicrepository/<path_in_repository>” to obtain a URL of an embedded image. (I’m assuming that’s what it means.)
I tried all kinds of variations like this:
Sub ImgPressed(oEvent as Object) ... oEvent.source.model.imageURL = "private:Pictures/10000000000001940000012FB99807BD.gif" ... End Sub
But nothing I tried worked.
I can also get the image I want using this:
oDP = ThisComponent.DrawPage oImg = oDP(0) If isNull(oImg) Then MsgBox("Got nothing!") MsgBox("The name of the image is " & oImg.Name) Exit Sub
So the above code can get me the actual image as an object. But what I need is to get the location of the embedded image as a URL string of some sort so that I can then assign it to the image control using:
I did a lot of searching for any example of this being done, but found nothing. Does anyone have any idea about this?