G
George Adams
I'm trying to do a mail-merge in Microsoft Word 2003 using an ODBC
connection to my MySQL database on my Linux box. The finished product
will be a paper name/address/phone/etc. directory for our church.
Normally this would work fine, except I don't want to just simply grab
and merge the data from certain fields in the database. I need to be
able to insert some programming logic.
For instance, I'll want to look at the age of the children listed in the
database, and if they're older than (say) 18, I won't display their
birthday. Or if a couple has its anniversary listed, I'll want to
format that in BOLD and display it. Or if the listed person is a
member, I'll want to format their name in a slightly different way.
etc. etc. All of which is a little much for SQL to handle (or at least
for *me* to handle in SQL).
For a normal project, this would be a simple job for Perl. What I can't
figure out is, is there anyway to insert Perl into this mail-merge
process? Obviously MS-Word wants to query a database over ODBC, not a
Perl script. Is there a way to change that so Word will get its data
from the Perl script directly (which would be written to generate that
data in whatever format Word is looking for it?)
Thanks to anyone who can help!
connection to my MySQL database on my Linux box. The finished product
will be a paper name/address/phone/etc. directory for our church.
Normally this would work fine, except I don't want to just simply grab
and merge the data from certain fields in the database. I need to be
able to insert some programming logic.
For instance, I'll want to look at the age of the children listed in the
database, and if they're older than (say) 18, I won't display their
birthday. Or if a couple has its anniversary listed, I'll want to
format that in BOLD and display it. Or if the listed person is a
member, I'll want to format their name in a slightly different way.
etc. etc. All of which is a little much for SQL to handle (or at least
for *me* to handle in SQL).
For a normal project, this would be a simple job for Perl. What I can't
figure out is, is there anyway to insert Perl into this mail-merge
process? Obviously MS-Word wants to query a database over ODBC, not a
Perl script. Is there a way to change that so Word will get its data
from the Perl script directly (which would be written to generate that
data in whatever format Word is looking for it?)
Thanks to anyone who can help!