<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Basic: insert graphicobject via ThisComponent.createInstance("com.sun.star.text.GraphicObject") not working in 6.1.0.3"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=119519#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Basic: insert graphicobject via ThisComponent.createInstance("com.sun.star.text.GraphicObject") not working in 6.1.0.3"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=119519">bug 119519</a>
              from <span class="vcard"><a class="email" href="mailto:struckkai@gmx.net" title="Kai Struck <struckkai@gmx.net>"> <span class="fn">Kai Struck</span></a>
</span></b>
        <pre>Xisco FaulĂ­,

Ok, after reading it and using the function getGraphFromUrlAsLink
for oGraph.Graphic I can make the above example code work: 


Sub InsertGraphicObject
 Dim oDoc
 Dim sURL
 Dim oCursor
 Dim oGraph
 Dim oText

 sURL= ConvertToUrl("<a href="http://pmg.pmgroup.be/enews/deroulard/exploit1.jpg">http://pmg.pmgroup.be/enews/deroulard/exploit1.jpg</a>")
 oDoc = ThisComponent
 oText = oDoc.getText()
 oCursor = oText.createTextCursor()
 oCursor.gotoStart(False)
 oGraph = oDoc.createInstance("com.sun.star.text.GraphicObject")
 oGraph.Graphic = getgraphfromurlaslink(sURL)  
 With oGraph
rem .GraphicURL = sURL
 .Width = 6000
 .Height = 8000
 End With

 oText.insertTextContent(oCursor, oGraph, False)

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


To get the URL of the image we now must use
oGraph.Graphic.OriginURL instead of oGraph.GraphicURL

If that means that all older code has to be adapted (possibly with a version
check to make it compatible with older versions) then I'm not too happy about
that.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>