tags:

views:

86

answers:

2

I'm attempting to manually create a mail merge using Word's XML (from Word 2007). I have the following XML which isn't working:

<w:mailMerge>
    <w:mainDocumentType w:val="catalog" />
    <w:linkToQuery />
    <w:dataType w:val="native" />
    <w:connectString w:val="Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=TheServer;Data Source=." />
    <w:query w:val="SELECT * FROM  `Table` WHERE `id_field` = 7" />
    <w:dataSource r:id="rId1" />
    <w:activeRecord w:val="0" />
</w:mailMerge>

I can't really figure out from the documentation what I'm supposed to do. This is just a mail merge from a database table. It says there's an error on the line <w:mainDocumentType w:val="catalog" />. I've looked up possible values of w:val without any luck. I can't find any decent documentation on it.

Anyone have any ideas?

+2  A: 

DII has all of the documentation and you can also look up on this site, like the mainDocumentType is listed as a CT_MailMergeDocType. Upon searching for that, I get which then tells me to look up ST_MailMergeDocType, where it lists the types.

Also, OpenXML Developer has some basic intro articles to MailMerge with WordprocessingML:

Otaku
Indeed, these are resources I've already been working with without any luck.
Kezzer
@Kezzer: So what's the question? You want to know the parameters needed for each w:val or...?
Otaku
+1  A: 

Can this be of some help?

Mail Merging With Word and Linq-to-Xml in VB

Richard B