Search my blog articles

Sunday, December 07, 2008

Binding Word 2007 Content Control to a custom XML data.

I have out-lined in brief steps how to bind a cusotm xml data to content control in a docx file. This article is not complete. I will update it with code and programatic explanations. 

so far....
Binding Content control to custom XML.
1. Download the following content control Toolkit from Code Plex.
2. Create a new FileSystem based web site on .net 3.5 frameworkon visual studio 2008.
3. For data base access create a new Link to SQL data source. 
4. Copy the Document that we need to merge to the App_data folder.
5. Open the docx file and insert all the content that we would like to bind at runtime. 
a. How to enable the developer tab to add these content controls. 
6. Save the file.
7. Using Visual studio create an xml file with the following Nodes. 


8.Start the Word 2007 Content Control ToolKit, Open the custom document that we created.  We can see the Content Controls present in the documents. Paste it inside the "Edit View" tab of the Custom XML Part section of the app. 

9. Switch to the "Bind View" tab select the individual xml nodes in the Tree view and drag it its corresponding content controls to creat the link between the custom xml nodes to the content control. 

10 Save the docx file. 

to be continued...

Reference links : 

Andrew coates




No comments: