I have an A.odt file writer with many embedded images. Via macro I created a reference first to file A and from this to the required image.
The structure of the macro used (work) is
sPathFull = "file: ///media/......./filename.odt '.... fullpath of file A Dim Props (0) As New com.sun.star.beans.PropertyValue Props (0) .Name = "Hidden" Props (0) .value = true 'also works with false oDoc = starDeskTop.loadComponentFromURL (sPathFull, "_Blank", 0, props) oImg = oDoc.graphicObjects.getByName ( "Image1")
Once the reference oImg is known, it can be used to insert a linked image in a B.odt file writer without extracting the required image in a directory from which to perform the link ?
Strangely, oImg,.GraphicURL is null, oImg was a jpg image ( LO type= com.sun.star.text.TextGraphicObject)
The solutions found so far, all using macros, are:
Insert oImg with embedded image with copy and paste, but it is not a linking
Insert a section S0 in A.odt to include the image, and in file B another section S1 linked to S0 (a possible but complicated solution if to be repeated on other images)
3) insert an hyperlink (URL = file:///media/…filename.odt#image2|graphic (but image is visible only after clicking and source file is to open
Libreoffice 22.214.171.124, Ubuntu 16.04