A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Word Mail Merge with xml



 
 
Thread Tools Display Modes
  #1  
Old November 26th, 2008, 03:38 PM posted to microsoft.public.word.mailmerge.fields
Jalz
external usenet poster
 
Posts: 5
Default Word Mail Merge with xml

Hello All,

Im interested in getting data out of one of our databases using XML/XSLT
into word. Does anyone know if it is possible to do this with word, and how I
can achieve this. I can't use odbc as the odbc seems very unstable with my db.

Any help/hints tips would be great.

Kindest regards

  #2  
Old November 26th, 2008, 05:41 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Word Mail Merge with xml

Out of the box, Word cannot use XML format data directly as a merge data
source, so the main issues become:
a. is there anything that you can easily transform your data into using
XSLT or otherwise and
b. does that have any benefit over other possible formats such as
tab-delimited

If you have over 255 columns, the only format that is supported "out of the
box" is basically "delimited text file", which either means a plain text
file or delimited text in another format Word can read natively such as .doc
(i.e. a Word document with one delimited text file row per record) or .rtf.
You may also be able to use .htm, which is probably the simplest option if
you can easily transform your XML via XSLT. Then you have to consider what
to do with characters in the data that are used as delimiters in the
delimited text file - in essence, you have to
- surround each field using double-quotes
- double up double-quotes in the data
- etc.

If you have 255 colums or fewer, you could consider trying to open simple
XML files in Excel, save as .xls(x), then use that as the data source
(by simple I mean an XML file that "emulates" a .csv type file, i.e. a file
with a simple structure like

row
element1data/element1
...
elementndata/elementn
/row

where every row has the same child elements)

If you have around 64 coulumns or fewer (whatever the maximum Word can store
in a table) then the simplest approach is probably to transform your XML
into a simple HTML document containing a single table with one row per
record. Word can use those as data sources.

If you are using Word 2003 or later, you can also consider using XSLT to
transform your data into WordProcessingML format, either aiming for
delimited format text (65 columns of data or more) or a Word table (64
columns or fewer). But it would be harder.

If your data uses characters outside the supported character set on your
system (e.g. if it uses Unicode extensively) then there is a secondary issue
as to which of the formats can preserve those characters and get them
through to mail merge.

If you are using Word 2007 this might be a good time to consider using the
merge approach that uses VBA/.NET code, content controls and a custom data
store to generate multiple copies of your document. But that's really
another story.

Sorry the picture is not rosier!

I can't use odbc as the odbc seems very unstable with my db.


What db is it? (Curiosity, mainly!)
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Jalz" wrote in message
...
Hello All,

Im interested in getting data out of one of our databases using XML/XSLT
into word. Does anyone know if it is possible to do this with word, and
how I
can achieve this. I can't use odbc as the odbc seems very unstable with my
db.

Any help/hints tips would be great.

Kindest regards


  #3  
Old November 26th, 2008, 08:27 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Word Mail Merge with xml

See the "Retrieving Information from an XML Document" section
of the article at http://msdn.microsoft.com/en-us/library/aa468547.aspx


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jalz" wrote in message
...
Hello All,

Im interested in getting data out of one of our databases using XML/XSLT
into word. Does anyone know if it is possible to do this with word, and
how I
can achieve this. I can't use odbc as the odbc seems very unstable with my
db.

Any help/hints tips would be great.

Kindest regards



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.