Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting pictures in word documents, automation of prop
Message
De
20/02/2002 16:10:12
 
 
À
20/02/2002 12:42:31
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00622488
Message ID:
00622794
Vues:
22
Hi Cetin,
Thank you for responding. I will work with your suggestions this evening. I however have additional questions. Just as I am able to change the default folder options under automation, I wonder if I can also change the default options for how an image will be opened in WORD. The default is NOT LINK TO FILE. I would like it to be. The default does not have the 2 check boxes I described earlier as checked. I would like them to default to un-checked. I also want the pictures to be formatted with the eqiv. of one of the dog buttons being pressed (bringing them to the graphic layer). In summary, I would like to change the defaults. I want the user to use the place holding image1 to mimic the ultimate position and size and text to image relationship of the actual merged image. This is why I feel that your suggested automation code may not work for my situation. I want the user to use image1 as if it were the actual merged image and the only thing that will change at merge time is the actual image.

Neil
>>Hi UTers,
>>
>>My vfp 7 uses WORD as an editor in one of my modules. Word enables a user to write letters in an environment in which they are already trained and comfortable using. Once a have control of WORD, I use automation to reassign some of the default folders. I then copy a place holding image named image1.jpg to the default image folder. The user can then easily find image1 and insert it into a document. Later, when the user wants to print the document, I automate a mailmerge. Just prior to the mailmerge automation, I replace image1.jpg in the directory with the actual image I want printed. In this way I have a generic template (WORD DOCUMENT) that will have a specific image for an individual patient once merged.
>>This is the rub. In order for the replacement image to display properly, image1 (the place holder) has to have certain properties. In the past I had the user do the following:
>>Select INSERT--> PICTURE-->FROM FILE from the menu. Select image1 from the list and then (here comes the magic) INSERT FROM FILE. That is how I establish the link to image1. Once image1 is on the document I request that the user bring the image out to the graphics layer simply by right-clicking on the image and selecting "format picture.." from the menu. Hit the "Layout" tab and select any one of the dog buttons. One last thing to make it work. I have the user hit the "size" tab and uncheck "lock aspect ratio " and " relative.." checkboxes. At merge time I massage the actual photo's width and height to preserve its aspect ratio in the given area that the user has defined with image1. Everyone loves the output but hates the fact that they have to set up image1's properties for it to function in this manner.
>>
>>Can I control the default properties of a picture when it is inserted onto a document? ie: 1)LINK TO FILE, 2)SET THE LAYOUT, 3) UNCHECK THE 2 CHECKBOXES. Can I use automation to do this? I feel this is an app breaker.
>>
>>
>>Please note that I hold vfp in a wait state while automating WORD so attempting to grab a WORD event does not work.
>>
>>Thanx,
>>Neil
>
>Neil,
>Shapes and InlineShapes collection would work for you I think.
>Shapes is harder to control, InlineShapes treats the picture as a character so I think with it you bypass 'dog' click. InlineShape has methods like AddPicture and properties like LockAspectRatio, Height, Width etc.
>
>
>* Assuming you're at insertion point
>oPic = oWord.Selection.InlineShapes.AddPicture(lcFileName, .t.)
>with oPic
> .LockAspectRatio = .F.
> .Line.Visible = .F.
> .Height = 300 && Points - use application conversion functions as necessary
> .Width = 400
>endwith
>
Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform