HI Stephan,

I tried with your solution and it worked perfectly. :) Thanks for taking time! I will try also the solution from Christian and compare which one performs better.

Thanks again for your help!

Best Regards,
MuiFull


Stephan Wunderlich wrote:

Hi MuiFull,

I couldn't find any UNO-Interfaces that help to insert unlinked graphics, but the dispatch-API seems to do the job, so something like


after looking some more I found some UNO-API calls that will at least work in OOo2.0

Sub Main
    oDoc = thiscomponent

xShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
    xTextContent = oDoc.createInstance("com.sun.star.text.GraphicObject")

    oDoc.getDrawPage.add(xShape)

GraphicProvider = createUnoService("com.sun.star.graphic.GraphicProvider")

    dim mediaprops(0) as new com.sun.star.beans.PropertyValue
    mediaprops(0).Name="URL"
    mediaprops(0).Value="file:///<YOURPATH>/<YOURFILE>"

    xGraphic = GraphicProvider.queryGraphic(mediaprops())

    xShape.Graphic = xGraphic
    xTextContent.graphicurl = xShape.graphicurl
    xText= thiscomponent.getText()
    xTextCursor = xText.createTextCursor()

    xText.insertTextContent(xTextCursor, xTextContent, false)

    oDoc.getDrawPage.remove(xShape)
End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to