Insert linked image from file A to file B using object reference to image in file A

asked 2020-01-24 18:07:30 +0100

torreone gravatar image

updated 2020-01-24 19:33:32 +0100

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
   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=

The solutions found so far, all using macros, are:

1) Insert oImg with embedded image with copy and paste, but it is not a linking

2) 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)

EDIT 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, Ubuntu 16.04

edit retag flag offensive close merge delete