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 12:42:31
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/02/2002 08:08:12
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00622488
Message ID:
00622671
Vues:
15
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform