How to add Sharepoint checkbox into the Word document.

The task:

There is a document library on Sharepoint portal. The document library contains a Boolean fields called checkboxcolumn.

You need to put the checkbox in the Word document, so when you turn it on/off, the checkbox in SharePoint changes.

 
 

When I could not google the solution and there were numerous places saying this is not possible, I have decided to blog it.

 
 

The solution.

Short version (for the ones who know how field mapping works in SharePoint):

 
 

The only problem with checkboxes is that when you use quickparts, the checkbox appears as true/false dropdown list. So you have to add it manually via XML pane on a developer toolbar.

 
 

Long version:

 
 

Let us say we have a library called Documets2 with additional checkbox column and a document:

 
 

 
 

Then we open the document for editing in Word.

 
 

 
 

Now the standard way of inserting SharePoint fields are Quick parts. For basic fields like text/date/etc. we could go to Insert\Quick parts\Document Property and there would have a list of Sharepoint columns.

 
 

However, if we insert quick part, it will look as dropdown!

 
 

 
 

 
 

 
 

To achieve the right result, we need to recall the principle of document columns integrations. What happens is that there is a custom XML inside the document with all column values. Each time we change something on SharePoint it changes the xml, each time we change the xml inside document, Sharepoint changes the column.

Then word uses data mapping that maps content controls to the internal xml data. If you are not familiar with this concept, you can read related articles listed at the bottom of this article.

 
 

So what we need to do is find the xml property and map it.

 
 

First please check that you have developer toolbar visible in Word. If not click "More Commands" on the ribbon, then customize ribbon, and then check the developer toolbar.

 
 

 
 

 
 

Now click XML Mapping pane.

 
 

 
 

Select https://schemas.microsoft.com/office/2006/metadata/properties (I think you might need to select other similar option in some cases).

 
 

 
 

Find your column (to be precise, projection of SharePoint column into xml embedded into word). Right click, select insert content control, select checkbox and you are good to go!

 

 
 

 
 

 
 

 
 

 
 

 
 

References

 
 

Using XML Mapping as Part of a Document Generation Solution in Word 2010

 
 

 
 

Create a rich Word document based on your own custom XML (without the need for XSLT)

 
 

Creating Data-Bound Content Controls using the Open XML SDK and LINQ to XML

Walkthrough: Binding Content Controls to Custom XML Parts

 
 

Word Content Control Toolkit

Comments

  • Anonymous
    May 10, 2016
    Worked like a charm. Thanks for your persistence in devising this simple solution.
  • Anonymous
    June 01, 2016
    This was exactly what I needed. Thank you for the detailed explanation and guidance.
  • Anonymous
    June 14, 2016
    thanks for help, i have one question, how can i check checkbox depending on value in quick parts from sharepoint?
    • Anonymous
      June 14, 2016
      I am not sure really. maybe create a calculated column?