| View previous topic :: View next topic |
| Author |
Message |
Fernand Guest
|
Posted: Thu Nov 20, 2003 5:07 am Post subject: Graphics not linked but stored in Document |
|
|
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

Joined: 28 Jul 2003 Posts: 751 Location: Staffordshire, UK
|
|
| Back to top |
|
 |
Fernand Guest
|
Posted: Thu Nov 20, 2003 9:06 am Post subject: Graphics not linked but stored in Document |
|
|
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 |
|
 |
|
|
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
|