Welcome to Office Zealot Sign in | Join | Help
SharePoint Server Content Type field binding to Content Controls in Word

One of the coolest things I like about SharePoint Server 2007 and Word 2007 is the ability bind information from your document to properties that can be viewed & edited in SharePoint. Unfortunately creating the seamless experience requires a few more, well a lot more, steps than I would prefer. Still, it only takes a matter of minutes to do this once you know what you're doing.

 

Here is a step-by-step walkthrough of how to bind a custom content type field to a content control in Word. For reference purposes after each navigation step that occurs in SharePoint, I’ve included the name of the page you should be on after performing the navigation.

 

1)      Create a Hello Word content type:

a.       Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)

b.      Click Site content types (mngctype.aspx)

c.       Click Create (ctypenew.aspx)

                                                               i.      Name: Hello Word

                                                             ii.      Select parent content type from: Document Content Types

                                                            iii.      Parent Content Type: Document

                                                           iv.      Click OK

d.      Add a column to the content type

                                                               i.      Click Add from new site column (fldnew.aspx)

1.      Column name: My Value

2.      Click OK

2)      Create a Hello Word document (optional template)

a.       Create a new word document

b.      Enter the text: Here is my content type field value:

c.       Save the document as “Hello Word” to local disk

3)      Associate the document with the content type

a.       Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)

b.      Click Site content types (mngctype.aspx)

c.       Click Hello Word (ManageContentType.aspx)

d.      Click Advanced settings (ChangeContentTypeOptionalSettings.aspx)

e.       Select Upload a new document template

f.        Click Browse and locate the Hello Word.docx document

g.       Click OK

4)      Create a document library that uses the Hello Word content type

a.       Site ActionsàView All Site Content (viewlsts.aspx)

b.      Click Create (create.aspx)

c.       Click Document Library (new.aspx)

                                                               i.      Name: Hello Word Library

                                                             ii.      Click Create

d.      Associate the Hello Word content type with the library

                                                               i.      SettingsàDocument Library Settings (listedit.aspx)

                                                             ii.      Click Advanced settings (advsetng.aspx)

1.      Allow management of content types?: Yes

2.      Click OK

                                                            iii.      Under the Content Types section click Add from existing site content types (AddContentTypeToList.aspx)

1.      Select site content types from: Custom Content Types

2.      Add the Hello Word content type

3.      Click OK

                                                           iv.      Click Change new button order and default content type (ChangeContentTypeOrder.aspx)

1.      Uncheck the Visible check box for the Document content type

2.      Set the Position from Top attribute of Hello Word to 1

3.      Click OK

4.      Click Hello Word Library in the breadcrumb to get to the default view of the document library.

5)      Bind the content type fields to content controls in Word

a.       Click NewàHello Word

b.      Place the cursor just after the text in the document (“Here is my content type field value:”)

c.       In Word now, select the Insert tab

d.      Select Quick PartsàDocument PropertyàMy Value

e.       Save the document to your LOCAL drive as “Hello Word”

6)      Upload the new bound version to the content type

a.       In SharePoint, Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)

b.      Click Site content types (mngctype.aspx)

c.       Click Hello Word (ManageContentType.aspx)

d.      Click Advanced settings (ChangeContentTypeOptionalsettings.aspx)

e.       Select Upload a new document template:

f.        Click Browse and locate the bound version of the document you just created.

g.       Click OK

7)      Test it out

a.       Go to the Hello Word Library and select New

b.      Enter a value in the My Value content control

c.       If the Document Information Panel isn’t displayed, select the round Office button in the upper left corner then PrepareàProperties

                                                               i.      In the document information panel (DIP), you can select either the custom properties (i.e. Hello Word Properties – Server) or the standard Document Properties). Make sure you’re viewing the Hello Word Properties. You should see two fields: Title & My Value

d.      Notice that the My Value field in the DIP contains the text you entered in the content control.

e.       Change the value shown in the DIP and notice that the content control value changes

f.        Save the document to the Hello Word document library.

8)      Modify the default view of the document library to include the My Value column

a.       In the Hello Word Library, select Modify this View from the View drop-down (ViewEdit.aspx)

b.      Check the Display field next to My Value

c.       Click OK

9)      Update the My Value field in SharePoint

a.       In the document library, select Edit Properties from the drop-down associated with your document (EditForm.aspx)

b.      Change the value shown in the My Value field

c.       Click OK

10)   Open the document in Word and notice that the updated value is shown in the content control. Sweet!

 

If your going to take this further by extending the template with VSTO, this is your starting point - a Word document that has already been bound to it's associated content type fields. Once you're ready to publish, you need to upload the VSTO extended document to the content type one more time while deploying the assemblies to another location.

Posted: Thursday, October 19, 2006 3:39 AM by hansen
Filed under: , ,

Comments

Anonymous said:

Does this same feature work with any other Office documents? In particular, Excel?

Thanks
Brad
# October 19, 2006 11:01 AM

hansen said:

Hi Brad,

Unfortunately it doesn't out of the box. It would be a great feature for Excel to exhibit similiar functionality.

That said, I've had success at duplicating the functionality by extending an Excel workbook so that it behaves in a similar manner. Basically you just add some event handlers to Excel that set the appropriate nodes in the custom xml part before sending up to SharePoint. When opening out of SharePoint, you do the reverse - retrieve the value of the relevant nodes and synch the "bound" cells. A little extra work, but many potential uses.

- Steve
# October 19, 2006 3:16 PM

Anonymous said:

Thanks Steve, I'll have to give that a try.
# October 20, 2006 5:38 AM

skaar said:

How is this done in content types defined as features? I have trouble provisioning a Word document and binding the fields.

# May 21, 2007 2:47 PM

Mirrored Blogs said:

Document and Records Management Definition Document Management According to Wikipedia : "A document

# October 3, 2007 10:14 AM

WebDev said:

Делай раз, делай два, делай три инструкция: http://blogs.officezealot.com/hansen/archive/2006/10/19/14129.asp

# April 25, 2008 2:50 AM

Sharepoint для разработчиков said:

Делай раз, делай два, делай три инструкция:http://blogs.officezealot.com/hansen/archive/2006/10/19/14129.asp...

# June 3, 2008 1:45 PM

spmikey said:

Excellent article, but there is a catch: If the SharePoint column field is a Lookup, then an index is rendered in the word document not the literal displayed in the drop down (Server properties). E.g. instead of ‘Mr Tibbs’ you get ‘1’. Can you suggest any ways to persuade Word to insert the literal not the index?

# June 10, 2008 7:42 AM

Arno Nel 2.0 said:

Document and Records Management Definition Document Management According to Wikipedia : "A document

# July 28, 2008 4:31 AM

khushi.sshaikh said:

Hi Steve,

I followed the above steps and bind the content controls in word with the sharepoint content type.

I am creating a web part through with user would enters data into the sharepoint content type fields.

I used InputFormTextField for entering a Employee's comment which is a multiline richtextbox. When I am entering Richtext and doing formatting like bold, italic, color.

The content in the word document is showing html tags instead of richtext.

How do i show rich text in a word document?

I would appreciate if you please reply me asap.

could you mention your twitter/hotmail for instant messageing.

Thanks & Regards

Khushi

# September 15, 2009 10:22 AM
Anonymous comments are disabled