Writer: Hyperlink einfügen
Verfasst: Mi 26. Feb 2020, 08:10
				
				Hallo,
ich versuche, einen Hyperlink auf eine andere odt-Datei in ein Writer-Dokument einzufügen:
XRay zeigt, daß das Link-Objekt erzeugt wird und die Property Format auf 2 gesetzt wird.
insertTextContent löst Exception IllegalArgument aus.
Wie mache ich das richtig?
Vielen Dank,
Fred
			ich versuche, einen Hyperlink auf eine andere odt-Datei in ein Writer-Dokument einzufügen:
Code: Alles auswählen
Sub InsertHyperlink(filePath As String)
 Dim url As String
 Dim oDoc As Object, oText As Object, oLink As Object
 
 oDoc = ThisComponent
 oText = oDoc.Text
 url = ConvertToUrl(filePath)
 oLink = oDoc.createInstance( "com.sun.star.text.TextField.URL" )
 oLink.URL = url
 oLink.Representation = filePath
 'XRay oLink ' -> Format = 2
 oText.insertTextContent(oText.getEnd(), oLink, false) ' Illegal argument
End SubinsertTextContent löst Exception IllegalArgument aus.
Wie mache ich das richtig?
Vielen Dank,
Fred