A continuation of this thread
Code like this works fine for me
Folder = "C:\Users\fjcc\Desktop\"
imagen = "W21_0.TIF"
ImagenURL = convertToURL(Folder & imagen)
oImagen_obj = ThisComponent.createInstance("com.sun.star.drawing.GraphicObjectShape")
oImagen_obj.GraphicURL = ImagenURL
oSize = oImagen_obj.Size
oSize.Height = 3000
oSize.Width = 3000
oImagen_obj.Size = oSize
oPos = oImagen_obj.Position
oPos.X = 2000
oPos.Y = 3000
oImagen_obj.Position = oPos
currentIndex = ThisComponent.CurrentController.ActiveSheet.RangeAddress.Sheet
oDP = ThisComponent.DrawPages.getByIndex(currentIndex)
oDP.add(oImagen_obj)
There is only one problem. I want these images to be inserted into spreedsheet as linked images - so ods file wont increase in filesize too much (I’m gonna keep source images in right directory no worries here).
I’ve read documentation about GraphicObjectShape
https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1drawing_1_1GraphicObjectShape.html
and found this GraphicStreamURL, so I’ve replaced
oImagen_obj.GraphicURL = ImagenURL
with
oImagen_obj.GraphicStreamURL = ImagenURL
My expectations were that this will place image in spreedsheet with linked image. It indeed creates object but with missing image:
Anyone knows how to handle this? Do I need to modify image path somehow? Or do I need to do this in completely different way?