Word2003 XML as data source ?

A

Andrew Kennard

Hi

I'm trying to use an XML file as a data source for mailmerging in Word 2003

However When I try and open it via the datasources button it does not open
it and asks me what is it delimited by !

Ultimately I want to automate this via COM from another application and have
done this so far using CSV files which works fine

When I use the OpenDataSource method I am passing wdOpenFormatText to it

As there is a wdOpenFormatXML I assumed I could use an XML file ?

However as I cant seem to get this to work 'manually' as a user ?

What am I missing ?

I need to use XML files to get over quote and comma problems. I also have a
large description field I wish to use. I had considered automating excel and
saving the data in an excel file and linking it to that but it has a 32k
cell limit size which is too small

Thanks

Andrew
 
P

Peter Jamieson

Unfortunately you can't use XML format data directly as a data source.
Believe me, I tried to get MS to support it several years ago, for exactly
the reason you quote.

Since the Excel approach isn't going to work, the only things I can suggest
are to
a. transform into an HTML table. The XSLT for that should be fairly
straightforward, but off the top of my head I cannot remember whether Word
imposes the same column count limit (around 63) as it does on its own
tables. Also, I do not know whether Word will accept the kind of text
volumes you mention using that format.
b. transform into a Word document containing a table in WordProcessingML
(i.e. Word 2003 WordProcessingML format). Harder, same limit on column
count, but it is more likely to work. If you are unfamiliar with
WordProcessingML then the first problem is to find out what XML you need to
output. The only way to do that IME is to create a Word table, save it as
XML, and start discarding stuff like font/style info. until you can no
longer open the .xml in Word. (I may have a good starting point for this but
it's a long time ago and would take some digging out. Before doing any of
that, I'd just check that you can use document in WordProcessingML format as
a data source.
c. (maybe) use ADO/ADOX to convert the data into .mdb format
As there is a wdOpenFormatXML I assumed I could use an XML file ?

This is really for opening WordProcessingML documents I think.
 
A

Andrew Kennard

Peter

Thanks very much for your reply

Looks like I'll have to get my thinking cap on !

Cheers

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top