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

Thanks for the replys.
As I dig deeper into this I'm finding some (dumb) constraints. There is
total resistance to change, especially if it involves any changes to customer
process. It's one of those , "thats how we have done it for years"
situations. In fact, even if I could do the merge for them my management
won't accept the change - they won't even offer that solution to the
customer. ???

It now looks like my issue is off topic for this fourm - it's generating an
Excel spreadsheet that is sorted and has types defined on the columns (e.g.,
the current export shows SSN's as floats or scientifics). Actually the code
is creating a CVS file which is made available on a web page. The CVS files
open in Excel by default and the users then have to massage the data and then
do the merge from there. I am supposed to do this in a Java/struts
environment (which I have about 2 mo. of exp.)- I'm a C#/.net guy and any
..net is a big no-no. It's crazy but I'm sure you've been in the same type of
situation somewhere in your career.

I think I'm still going to take an XML approach as you can import an XML
file into excel based on a xsd and put up a real Excel file. Hopefully I can
just write a shell script (under the covers) to do the data extract and the
excel launch, having the Java only call the script.

Again, thanks for the reply - your information will certianly be useful in
other situations.

"Gwal" wrote:

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

.