Thread: Merge from XML
View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Gwal Gwal is offline
external usenet poster
 
Posts: 3
Default Merge from XML

My end users cannot access SQL Server. We currently generate an Excel file
that is sent to them based on a date range they submit from a web page. They
are doing the merge. The issue they are having is character data that is all
numbers are treated as numbers in Excel during a simple import, and their
mearge fails unless they massage the columns. I just picked up this task
today and hoped XML would merge. I'm trying to get rid of the extra steps
they need to take and provide the merged docs for them.

I may try to writing something that merges the files programatically if that
makes any sense. The word 2007 .docx files are stored as XML. Have you
heard anything about taking this approach? Are there any links you can
provide if so?

Worst case I could write some VBA to do the formatting and massaging of the
data.
Thanks

"Peter Jamieson" wrote:

Is it possible to use an XML data source for mail merge?


No. At least, not directly. Depending on the layout/content of the XML,
and what you need to achieve, you could consider
a. trying to open the XML in Excel. If you can end up with a tabular
format in there, you can save it and use it as the data source for a
merge. (Or you might be able to use some other program to do something
similar)
b. using an XSL transform to convert the XML to a format Word can use.

I am exporting data
from SQL Server in XML format


FWIW, if you can access SQL Server directly from your workstation you
should be able to connect from Word to a SQL /Table/ or /View? directly
and use it as a data source, although in recent versions of SQL AFAICS
you have to be using integrated Windows Authentication, not SQL Server
logins. However, with recent versions of Word it does not appear to be
possible to connect to stored procedures.

Peter Jamieson

http://tips.pjmsn.me.uk

On 13/04/2010 17:37, Gwal wrote:
Is it possible to use an XML data source for mail merge? I am exporting data
from SQL Server in XML format and would like to merge it into a .dotx
template. Thanks

.