OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Graphics not linked but stored in Document

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Fernand
Guest





PostPosted: Thu Nov 20, 2003 5:07 am    Post subject: Graphics not linked but stored in Document Reply with quote

Hey to All,

By putting "off" the LINK button when Inserting a Graphic, the Image is stored IN the document. When caling the GraphicURL property for that Image (by a macro) then we get somting like:
"vnd.sun.star.GraphicObject:100000000000032000000258A1E6E2E3" as the URL.

3 questions:

- How can a graphic been inserted by a macro, IN the document and not as a link to an exterrnal grapic
Now I used somting like:
Code:
oGraphicObject = oDoc.createInstance("com.sun.star.text.GraphicObject")
      oGraphicObject.GraphicURL = sGraphicURL
      oViewCursor = oDoc.getCurrentController().getViewCursor()
   oCursor = oText.createTextCursorByRange(oViewCursor)
    oText.insertTextContent(oCursor(), oGraphicObject, false)


- Wath "property" item can best be used to store the external file name (some are write proteted)


Fernand [/b]
Back to top
avantman42
Super User
Super User


Joined: 28 Jul 2003
Posts: 751
Location: Staffordshire, UK

PostPosted: Thu Nov 20, 2003 5:26 am    Post subject: Re: Graphics not linked but stored in Document Reply with quote

Fernand wrote:
- How can a graphic been inserted by a macro, IN the document and not as a link to an exterrnal grapic

This problem is discussed, with a not-very-elegant solution, at http://www.oooforum.org/forum/viewtopic.php?t=2788&highlight=. Working code using this solution can be found in my Impress Photo Album Creator (available on OOoMacros: http://www.ooomacros.org/files.php?type=macro#ImpressPhotoAlbumCreator)

Russ
Back to top
View user's profile Send private message
Fernand
Guest





PostPosted: Thu Nov 20, 2003 9:06 am    Post subject: Graphics not linked but stored in Document Reply with quote

Russ,

Thanks for he quick repons, very Ugly solution indead, and not so handy for WriterDocs, I prefered to uses the Dipatcher thing and putting the "AsLink" argument to FALSE.
It puts an Image on the ViewCusorplace (format is set to 100% of the envoriment)
Then we moves en shapes the Image.
But why can it not be done with the Boolean argument in oText.insertTextContent(oCursor(), oGraphicObject, false) ??? is it a bug ????
In the old STARbasic stuff it was done like that.

Code:
dim dispatcher as object
dim oDoc2 as object
odoc2   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(3) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FileName"
args1(0).Value =  sGraphicURL  '"file:///C:/Office52/share/gallery/photos/apples.jpg"
args1(1).Name = "FilterName"
args1(1).Value = "<All formats>"
args1(2).Name = "AsLink"
args1(2).Value = false
args1(3).Name = "Style"
args1(3).Value = "Graphics"

dispatcher.executeDispatch(oDoc2 , ".uno:InsertGraphic", "", 0, args1())

    oAllFot = oDoc.getGraphicObjects
    oLSTFot = oALLFot.getElementNames()
    oGraphic = oALLFot.GetByName("Graphic1")
    tot = UBound(oLSTFot) 
    Msgbox "Reeds " + tot + " Illustraties in dit document" ' tot publiceren is absoluut nodig om ActualSize in te vullen
    oGraphic.Name = "Fot" + (tot + 1) ' moet telkens uniek zijn
    iOriFotW = oGraphic.ActualSize.Width 
    iOriFotH = oGraphic.ActualSize.Height
    sRasterPagina = oDialog.Model.opPagina.text
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group