Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word mail merge tags?
Message
From
18/02/2008 11:12:26
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP1
Miscellaneous
Thread ID:
01293093
Message ID:
01293465
Views:
19
Thanks for the code example. I appreciate the effort.

The example is good for a post merge process method and I almost certainly will have to do it that way. I built pre and post merge method calls into my framework and use them when I have unique things to do to documents such as conditionally adding tables of information for one recipient but not another in the same merge run.

I was just hoping that someone knew how to embed control codes somehow in a string that Word could interpret at merge time.

John and Cetin, thanks for your suggestions as well.

Gary


>>What I'm talking about is bolding parts of a single merge field. A given letter might have a single merge field with text that I've generated at runtime that might look something like:
>>
>>Item1: Some Book Name Ship Date: 2/15/08
>>Item2: Another book Back Ordered
>>.
>>.
>>.
>>Itemn: Last thing on order
>>
>>The entire string is contained in a *single* merge field, yet I'd like to be able to bold "Item1:" and "Ship Date:"
>>
>>It's hard to give enough examples here to really show the utility of what I'd like to do. The short story is that I build portions of documents on the fly and the ability to do something like:
>>
>>Item1: Some Book Name Ship Date: 2/15/08
>>
>>in the text string that fills the merge field and have Word make it bold would be useful. Probably not possible.
>>
>>Gary
>
>Now I understand your problem.
>You have one merge field with a long text in it and you want to bold some items in it Right?
>If so you could bold them AFTER you generate the document:
>
>#define wdFindContinue  1
>#define wdReplaceAll    2
>
>m1 = CREATEOBJECT([Word.Application])
>m1.Documents.Add()
>m1.Visible = .t.
>TEXT TO lcText NOSHOW
>Item1: Some book Shipped Date 01/01/2008
>Item2: Some book Shipped Date 01/01/2008
>Item3: Some book Shipped Date 01/01/2008
>Item4: Some book Shipped Date 01/01/2008
>Item5: Some book Shipped Date 01/01/2008
>Item6: Some book Shipped Date 01/01/2008
>Item7: Some book Shipped Date 01/01/2008
>Item8: Some book Shipped Date 01/01/2008
>Item9: Some book Shipped Date 01/01/2008
>Item10: Some book Shipped Date 01/01/2008
>Item11: Some book Shipped Date 01/01/2008
>Item12: Some book Shipped Date 01/01/2008
>Item13: Some book Shipped Date 01/01/2008
>Item14: Some book Shipped Date 01/01/2008
>ENDTEXT
>m1.Selection.TypeText(lcText)
>
>
>**** Find and BOLD all words like ItemX: where X is one digit
>m1.Selection.Find.ClearFormatting
>m1.Selection.Find.Replacement.ClearFormatting
>m1.Selection.Find.Replacement.Font.Bold = .t.
>m1.Selection.Find.Execute("Item^#:", .f., .f., .f., .f., .f., .t., wdFindContinue, .t., "",wdReplaceAll)
>
>**** Find and BOLD all words like ItemXX: where XX are two digits
>m1.Selection.Find.ClearFormatting
>m1.Selection.Find.Replacement.ClearFormatting
>m1.Selection.Find.Replacement.Font.Bold = .t.
>m1.Selection.Find.Execute("Item^#^#:", .f., .f., .f., .f., .f., .t., wdFindContinue, .t., "",wdReplaceAll)
>
>**** Find and BOLD all words like Shipped Date
>m1.Selection.Find.ClearFormatting
>m1.Selection.Find.Replacement.ClearFormatting
>m1.Selection.Find.Replacement.Font.Bold = .t.
>m1.Selection.Find.Execute("Shipped Date", .f., .f., .f., .f., .f., .t., wdFindContinue, .t., "",wdReplaceAll)
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform