On Wed, Dec 10, 2008 at 6:28 PM, Steve Ellenoff <[EMAIL PROTECTED]> wrote:
> Any Word Mail Merge gurus out there know how to simulate multi detail bands?
>
> I have a vfp app which generates a dbf of people who should receive a
> word document selected by the user and this works just fine, ie, I've
> got automation doing the merge automatically.

Yes, I do this.  I'm actually merging from Excel into Word but DBFs
should work too.
Basically you need to populate a (memo?) field with the detail values
separated by carriage returns (probably linefeeds too, I forget).

For example:

m.name = "Fred"
m.product = ""
m.productcode = ""
SELECT items
SCAN
   m.productcode =  + items.productcode + CHR(13) + CHR(10)
   m.product = m.product + RTRIM(items.product) + CHR(13) + CHR(10)
   INSERT INTO exporttable FROM MEMVAR
ENDSCAN

There is a few caveats.  First, you *must* place the detail merge
codes in a Word table.  Like this:

Dear <name>, here are your products:
+---------------------+-------------+
+<productcode>|<product>|
+---------------------+-------------+

The second problem is that you are limited to what formatting you can
do in Word.  Left & right justify work (nice for currency values) but
you can't format individual rows.  e.g. $999,999.99 for currency.
You'll have to do that during the export process.  Also, your data
must be strings.

It actually works remarkably well.  I use it for producing custom
letters and invoices.  The user selects which fields they require and
has control over the layout of the Word document.  Multi detail bands
work too.  There is an option in Word to allow a table to flow across
pages, remember to set that.

I can send you an example Word & Excel document tomorrow if you want.

-- 
Paul


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to