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

How to insert a graphic into a document
Goto page Previous  1, 2, 3
Post new topic   Reply to topic Forum Index -> Code Snippets
View previous topic :: View next topic  
Author Message
Jones Abramoff

Joined: 07 Nov 2005
Posts: 1

PostPosted: Mon Nov 07, 2005 1:35 pm    Post subject: Reply with quote

I have installed OO 2.0 and I am trying to create a Writer document using VB6.
In this document I want to insert a single graphic on each page.
I have been able to insert a graphic using a code like this:
Set args1(0) = MakePropertyValue("FileName", ConvertToUrl(sPathFigura))
Set args1(1) = MakePropertyValue("FilterName", "<Todos os formatos>")
Set args1(2) = MakePropertyValue("AsLink", False)
Set args1(3) = MakePropertyValue("Style", "Figuras")

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

It works ok but the graphic stays selected. When I try to insert a page break with the code below it doesn't work.

Set args2(0) = MakePropertyValue("Kind", 3)
Set args2(1) = MakePropertyValue("TemplateName", "")
Set args2(2) = MakePropertyValue("PageNumber", 0)

Call dispatcher.executeDispatch(document, ".uno:InsertBreak", "", 0, args2())

If I go to Writer and press ENTER between inserting the graphic and the page break, it does work.

I had also tried to use LoadGraphicIntoDocument but in the oBitmaps.insertByName of its implementation I am receiving vb error 1001.

Definitions like "" gives me errors. What should I reference to avoid it ?


Back to top
View user's profile Send private message
Capitan Blood
General User
General User

Joined: 07 Jun 2007
Posts: 11

PostPosted: Thu Jun 14, 2007 12:48 am    Post subject: Reply with quote

anoy body can tell me how insert picture in Calc
all exemple that i see use, but i can't take this object - it's always null

anobody please help me - i simply need insert picture(from file, or clipboard) in cell in calc
Back to top
View user's profile Send private message
Dhara Shah

Joined: 21 May 2009
Posts: 1
Location: India

PostPosted: Thu May 21, 2009 4:24 am    Post subject: cant load same image again Reply with quote

Hello ,
I am very new in this field ...and so trying/learning things using this forum.
I wanted to add an image in open office writer which i did according to the following example ...

Now my problem is ,
I can insert image only once ..if i insert the same image again got the error
Info Traceback (most recent call last):
File "", line 135, in insert_image
graphic.Name = cInternalName
Dhara Shah
Back to top
View user's profile Send private message
Joan Perals Tresserra

Joined: 02 Mar 2010
Posts: 1

PostPosted: Tue Mar 02, 2010 10:33 am    Post subject: Problem embedding images in 3.2 Reply with quote

I have been using Andrew Pitonyak's LoadGraphicIntoDocument function for some time now in a macro I am writing for Impress, and worked very fine until today after upgrading OOo 3.1 to 3.2. I have tested exactly the same sets of code under the two versions and under different computers and the results differ according to the OOo version only.

My macro uses the LoadGraphicIntoDocument function in a loop. On every iteration, a new page is created, into which an embedded image is inserted, like this:

   PathToFileURL = ConvertToURL(PathToFile)
   PathToFileURL = LoadGraphicIntoDocument(Album, PathToFileURL, "image"+PageNumber)
   GraphicsShape = Album.createInstance("")
   GraphicsShape.GraphicURL = PathToFileURL
   Page = Album.drawPages(PageNumber)

LoadGraphicIntoDocument function is declared later, untouched. This worked fine until today. But now, after the process all the images are equal! It's the last one reproduced n times. However, the image ratio varies accordingly to the images they should "be". So the actual next line in the code:

   PictureSize = GraphicsShape.GraphicObjectFillBitmap.GetSize

that I use to adjust the ratio, seems to work fine actually. Morevoer, I have tried to debug using both message boxes and xRay, and everything looks fine, as for every call to LoadGraphicIntoDocument the values of both external and internal URLS are different, as well as the internal names.

Now my only guess is that something's wrong in OOo 3.2's management of the.BitmapTable...

Or does anyone know something that could help?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> Code Snippets All times are GMT - 8 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

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