[Libreoffice-bugs] [Bug 119519] Basic: insert graphicobject via ThisComponent.createInstance("com.sun.star.text.GraphicObject") not working in 6.1.0.3
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Aug 28 10:10:01 UTC 2018
https://bugs.documentfoundation.org/show_bug.cgi?id=119519
--- Comment #7 from Kai Struck <struckkai at gmx.net> ---
With simple version check for compatibility for older Versions (just for info,
still hoping not being forced to use it):
Sub InsertGraphicObject
Dim oDoc
Dim sURL
Dim oCursor
Dim oGraph
Dim oText
sURL= ConvertToUrl("http://pmg.pmgroup.be/enews/deroulard/exploit1.jpg")
oDoc = ThisComponent
oText = oDoc.getText()
oCursor = oText.createTextCursor()
oCursor.gotoStart(False)
oGraph = oDoc.createInstance("com.sun.star.text.GraphicObject")
if Officeversion="LibreOffice6.1" then
oGraph.Graphic = getgraphfromurlaslink(sURL)
else
oGraph.GraphicURL = sURL
end if
With oGraph
.Width = 6000
.Height = 8000
End With
oText.insertTextContent(oCursor, oGraph, False)
if Officeversion="LibreOffice6.1" then
msgbox oGraph.Graphic.OriginURL
else
msgbox oGraph.GraphicURL
end if
End Sub
function getGraphFromUrlAsLink(sFileUrl as String ) as Object
oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
Dim oPropsIN(1)as new com.sun.star.beans.PropertyValue
oPropsIN(0).Name = "URL"
oPropsIN(0).Value = converttoURL(sFileUrl)
oPropsIN(1).Name = "LoadAsLink"
oPropsIN(1).Value = TRUE
getGraphFromUrlAsLink = oProvider.queryGraphic(oPropsIN())
end function
function Officeversion
GlobalScope.BasicLibraries.loadLibrary("Tools")
Officeversion = GetProductName()
end function
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180828/a0283896/attachment.html>
More information about the Libreoffice-bugs
mailing list