Manually create a Word document by binding a custom xml document to a template Word document

This post describes how you can create a Microsoft Office Word (2007/2010/2013) document by merging a Word template and a custom xml document.


Note: This post uses Microsoft Office Word 2013, but the same applies to Microsoft Office Word 2007 and 2010.



Open Microsoft Office Word 2013 open the developer tab on the ribbon




If the developer tab is not visible, go to File > Options



Go to Customize Ribbon > Enable "Developer" tab



First insert some text, a table and an image to give the template some body.

Now insert a Plain Text Content Control



Click on Properties and enter as:

Title: "CustomerName"

Tag: "CustomerName"



Save the document to "C:\Temp\CustomerInfo.docx" and close Microsoft Office Word



Rename the file to "C:\Temp\"




Extract the file to "C:\Temp\CustomerInfo"




Add the folder "C:\Temp\CustomerInfo\customXml"




Create the files item1.xml and itemProps1.xml and the folder _rels in the folder "C:\Temp\CustomerInfo\customXml"





<name>Customer 1</name>






<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<ds:datastoreItem ds:itemID="{8f93798d-1506-45f2-811e-70f72165a32d}" xmlns:ds="" />

The itemID is just a GUID.



You can create a new GUID with Microsoft Visual Studio:




Create a file item1.xml.rels in the folder "C:\Temp\CustomerInfo\customXml\_rels"

<?xml version="1.0" encoding="utf-8"?>

<Relationships xmlns="">

<Relationship Type="" Target="/customXml/itemProps1.xml" Id="Rb8d5386a2f8640f88dad1eff30868bcf" />


The Id is just a GUID without "-".

Edit the file "C:\Temp\CustomerInfo\word\_rels\document.xml.rels"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<Relationships xmlns="">

<Relationship Id="rId3" Type="" Target="webSettings.xml"/>

<Relationship Id="rId7" Type="" Target="theme/theme1.xml"/>

<Relationship Id="rId2" Type="" Target="settings.xml"/>

<Relationship Id="rId1" Type="" Target="styles.xml"/>

<Relationship Id="rId6" Type="" Target="glossary/document.xml"/>

<Relationship Id="rId5" Type="" Target="fontTable.xml"/><Relationship Id="rId4" Type="" Target="media/image1.jpeg"/>

<Relationship Type="" Target="../customXml/item1.xml" Id="Rdfc14bfb0c244ab3" />


The ID is a GUID without "-".


Edit the file "C:\Temp\CustomerInfo\word\document.xml"

Search for "CustomerName" in the file.


Add <w:dataBinding w:xpath="/root/customer[1]/name[1]" w:storeItemID="{8f93798d-1506-45f2-811e-70f72165a32d}" />

just after the <w:sdtPr> containing the CustomerName content control.





Edit the file "C:\Temp\CustomerInfo\[Content_Types].xml"


Now when you zip the contents of the folder "C:\Temp\CustomerInfo" and rename the zip to CustomerInfo2.docx, the CustomerName content control should be automatically filled with the text "Customer 1" from the item1.xml file.

When zipping make sure, you zip the contents of the folder en not the folder itself:



These manual steps can be automated by using the tool: (Word Content Control Toolkit)

This tool was created for Office 2007, but can be used for Office 2010 and Office 2013.

Short cut for pasting unformatted text, with the default paste options in Microsoft Office 2010

In most cases when I copy text from a source document or website and want to paste this text in Microsoft Office Outlook or Microsoft Office Word, I want the text to be formatted like the destination document (pasting as unformatted text). Previously I used two methods to accomplish this:

  • Paste > Paste Special > Unformatted Text > OK ( 4 clicks)
  • Notepad ctrl+a then ctrl+v the ctrl+a and then ctrl+c (1 click but many key presses)

Paste special dialog


In Microsoft Office 2010 (and perhaps in older Microsoft Office versions) you can now set default paste options to unformatted text. The pasted text will be formatted like the destination document

In Microsoft Office Word 2010

  • File > Options > Advanced > [Cut, copy and paste] section > Keep Text Only


In Microsoft Office Outlook 2010

  • Open a new mail message
  • File > Options > Mail > Editor Options > Advanced > [Cut, copy and paste] section > Keep Text Only


When you paste text in you’re mail or word document, it will be formatted like the mail or document.


Microsoft Office 2010 OneNote

  • In Microsoft Office 2010 OneNote, you can use the [Contenxt Menu Key] + T, instead of [CTRL + V] to paste unformatted text.
  • Or use alt + h + v + t

Microsoft Word 2007 and Squares before every line when "Show paragraph marks" is on

When you open a Microsoft Office Word 2007 document and turn on the "Show paragraph marks" (Ctrl + *), you might find squares before every line. This is because the Paragraph – Line and Page Breaks function Keep with next is turned on.

You can turn this function off by following the steps:
Select the text
Right click on the selected text
Click on Paragraph…
Click on the tab Line and Page Breaks
De-select Keep with next
Click on OK

Data Driven document generation with Microsoft Office Word 2007

Have you ever wanted to create a word document en changing some values in that Word document, by database values entered through a Windows or Web application?

Now you can, with Data Driven document generation with Microsoft Office Word 2007