Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OLE Insert image (from application server) into word document

Former Member
0 Likes
1,419

Hi all:

I need to insert an image into word document (this images has been upload from OAAD transaction and are stored in AL11 in dir_home dicectory), so this images are already in system. I know that with CALL METHOD OF wordobj 'InsertPicture' instruction you can insert an imagen from c: file (local pc file) but I don´t know how can I do that from application server.

Thanks in advance

Abel

5 REPLIES 5
Read only

Former Member
0 Likes
960

Hi Abel,

have you solved this problem? I need to export a picture from server to word too and I cannot do it. In addition, when I export the picture from PC to word, I cannot modify the size and the image appears very high. Could you tell me if you can modify the image?

Thank you.

Best Regards.

Read only

Former Member
0 Likes
960

Hi,

I need the same functionality in my program. Is there any solution for this?

Thanks,

Ask

Read only

Former Member
0 Likes
960

Hi,

I am having this issue as well! Hope experts out there can help on this issue.

Thanks in advance!

Read only

0 Likes
960

One way to do this would be to

- download the image to a temporary directory on your presentation server (the local PC). Use ARCHIVFILE_SERVER_TO_CLIENT .

- Then load the image to WORD using OLE automation

*The object to manipulate word...

INCLUDE ole2incl.

DATA:

word TYPE ole2_object,

docs TYPE ole2_object,

doc TYPE ole2_object,

selection TYPE ole2_object,

...

*Create the required objects...

CREATE OBJECT word 'WORD.APPLICATION'.

CALL METHOD OF word 'Documents' = docs.

CALL METHOD OF docs 'Add' = doc.

CALL METHOD OF doc 'Activate'.

GET PROPERTY OF word 'Selection' = selection.

...

*To make word visible

SET PROPERTY OF word 'Visible' = 1.

...

*To write the image ...

*define the inlineshapes or shapes objects and then CALL the word method AddPicture of these objects to add the image.

*vba code examples for this would be

*wd.Selection.InlineShapes.AddPicture will add a picture in line with the text;

*wdDoc.Shapes.AddPicture will add a picture that can float in front/behind text.

  • ActiveDocument.Shapes.AddPicture _

  • FileName:="C:\Program Files\Microsoft Office\" _

  • & "Office\Bitmaps\Styles\stone.bmp", _

  • LinkToFile:=True, SaveWithDocument:=True

I will let you put together the code. I will need to do this in a few months but have other deadlines currenlty.

...

*To save and exit word...

CALL METHOD OF doc 'SaveAs' EXPORTING #1 = 'c:\testword.doc'.

CALL METHOD OF word 'Quit'.

Please do post your results and award as appropriate if this is helpful.

Best regards,

Olivier

Read only

0 Likes
960

Hi Olivier

Hope all is well with you.

Was this performed successfully ?Exporting an image from the presentation server to the word document ?

regards,

Darryl