Now let’s complete our InfoPath form and save some data: I recommend switching on design mode to ensure you have got all of the controls on and they are tagged correctly giving you something like: Perform this action for all of the fields you wish to populate, where the same field is used you can copy+paste content controls which will retain the same tag. You should then put some meaningful text in the ‘Tag’ field as you will need this to identify the control later. Next we need to set the properties for our new control by highlighting the control and clicking properties. We do this by highlighting the text and then selecting the plain text control from the developer toolbar as below: We must now convert the temporary placeholder text for Word Content Controls. Now we want to replace the values inside with values that come out of our Infopath form. In this case we’ll assume the document has been written by someone else and merged in fields have been clearly shown such as: This should form should be self-explanatory so lets move on to the template word document. For this data source we will use an Infopath form as below: customer name) the second are the template documents. There are two categories of data source, the first is the content for the customisations (i.e. You would rather not convert the document to an XSL as the document changes quite frequently and you don’t want the burden of changing the documents each time, a solution whereby the user’s can change the template would be preferable. You would like to generate these documents automatically on a server without having to automate MS Word (!).
![microsoft word 2007 content control microsoft word 2007 content control](https://cdn.slidesharecdn.com/ss_thumbnails/word2013-templatecontentcontrol-140703074052-phpapp01-thumbnail-4.jpg)
You have a standard set of documents that you require customers to fill in at the start of a new engagement, these documents are full of customisations of the customer’s name, order details etc. The Word 2007 Content Control Toolkit available here.A source XML file, in my case I’m going to use Infopath 2007.In order to run through this you will need the following: First things first, I exaggerate a little when I say programmatically what I really mean is not manually! What we’re going to look at is effectively performing a mail-merge without having to use any COM or other API nasties, just the CustomXML support within MS Word.