Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding FormFields to a word document
Message
 
À
16/10/2007 09:44:04
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01261174
Message ID:
01261229
Vues:
10
>Can anyone help me with adding Formfields to a Word Document using automation? I am trying to scan a table and add formfields to a document with default text from the field in my table.
>
>The way that I generally do this is to create a Word Template (.dot) with Named BookMarks. If I name the bookmarks the same as the field in the table, the code to replace them is very simple:
>
>
>WITH This.oWord
>  *** Now replace all the bookmarks in the template.  Since we have set this up to have
>  *** the template names match the bookmark names, just loop though the bookmarks collection
>  *** and replace with the variable of the same name.
>  FOR EACH loBookMark IN .ActiveDocument.Bookmarks
>    lcVarName = loBookMark.Name
>    loBookMark.Range.Text = EVALUATE( ALLTRIM(lcVarName) )
>  ENDFOR
>ENDWITH
>
I second this approach. Users can compose their own letters to their liking. One thing with MSWord, it wont allow you to specify the same bookmark in more than one place. For example, if there's a rqmt to reference [LASTNAME] more than once in a DOC, you need to use a bookmark naming/numbering scheme of sorts for repeated bookmarks. [LASTNAME1] [LASTNAME2]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform