Hello Together,
in Andrew Pitonyaks OOME Forth Edition Doc Rev. 633 there is a Listing 343 “Insert a Graphics as a link at the start of the document”. Following you’ll find the code I’m using:
sub subInsertGra
Dim oText
dim oDoc as variant
dim sBildURL
oDoc = thisComponent
sBildURL = convertToURL("C:\temp\jpg\Bild.JPG")
InsertGraphicObject(oDoc, sBildURL)
end sub
Sub InsertGraphicObject(oDoc, sURL$)
Dim oCursor
Dim oGraph
Dim oText
oText = oDoc.getText()
oCursor = oText.createTextCursor()
oCursor.goToStart(FALSE)
oGraph = oDoc.createInstance("com.sun.star.text.GraphicObject")
With oGraph
.GraphicURL = sURL
.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
.Width = 6000
.Height = 8000
End With
'now insert the image into the text document
oText.insertTextContent( oCursor, oGraph, False )
End Sub
The Listing inserts the Graphic, but it doesn‘t generate a link, it embedds the graphic. But we need the link, what is wrong, how can I get a link. At the picture you see the missing link.
We use a german LibreOffice 6.3.4.2 under Windows 10, but in LibreOffice 7.0.4.2 on Windows10 its the same.
Best Regards
Wolfgang