Showing posts with label Quick Parts. Show all posts
Showing posts with label Quick Parts. Show all posts

Monday, 19 December 2011

Using quick-parts to automatically update fields in Word document, from the metadata in a SharePoint document library

Using quick-parts to automatically update fields in a Microsoft Office document, from the metadata in a SharePoint document library

Sometimes you find yourself in the scenario where you need to capture metadata as part of a document (for instance a Quote or a legal documnet, which then populates throughout the document where ever the field is placed. Sure, this doesn’t happen a lot, but when it happens, making use of quick parts is an easy way to do it.

Step 1: Create a SharePoint document library as you usually would

Step 2: If the document template is reusable, create a Site Content type as you usually would and add the site columns to it you would like to associate with it

image

Otherwise you could simply create list level custom columns and upload the document we’ll be creating in a minute under advanced settings

image

image

Step 3 (I will assume you are using a custom content type):

Create a new document of the content type you just created (for this demo I based it on a Medical Report required by one of our local banks for Insurance purposes)

image

Step 4: After creating a new document, save it first, or it won’t allow you to insert the metadata values from the document library. Call it anything, this is a temporary document.

Step 5: With the document open, click the Insert tab –> Quick-Parts –> Document Property –>
and select the property you would like to insert

image

Step 6: Repeat step 5 for all the properties you want to see on your document. You will immediately see the property fields fill them selves as you fill in the metadata at the top

image

Step 7: Once you’ve finished updating the document template with all the required fields, save it offline – i.e. to your desktop.

Step 8: Upload the document you saved offline as the template to be used for your content type

image

And that’s it! You will notice that if you change the metadata in the column on SharePoint, the values will be changed as soon as you open the document again.

Use Quick Parts to Display Metadata fields

We're looking at 'Quick Parts' in Word.   So, what in the world do Quick Parts have to do with SharePoint?  Well, Quick Parts allow us the opportunity to display metadata fields, that we use in our SharePoint library, into the body of the document template we are using for our Library (they probably do other things too, but this is the only thing I've messed with).  Effectively, this means that for those instances when it would be useful for users to be able to enter (or view) metadata within the body of the document, you have that option.  For example, a library has metadata fields that require significant explanation for people to know how to fill them in.   Using Quick Parts, you can add the metadata fields to your document, along with any descriptive text needed.  And since everything is displayed through a document interface, we can organize and format the fields and descriptions in whatever way is appropriate (our options for adding descriptive text for a column is much more limited).

Example:

 

A note to those of you familiar with InfoPath: 'Plug your ears'.  Comparatively, the functionality of Quick Parts is very limited and will likely leave you feeling like you're trying to eat melting ice cream with a fork (in a pinch, seemed like a decent idea, but doesn't end up doing what you'd hoped).  However, though not nearly as powerful a tool as InfoPath, for those of us that don't have that application installed, or are more comfortable with Word, Quick Parts can be a handy option.

Another Note: Some knowledge of creating Content Types is needed for this.

To Use Quick Parts in your SharePoint Library: 

1.    Create your new library

2.     Build the appropriate columns (if you add out-of-the-box quick parts first, appears to be no way to promote them).

3.      Create a new document in the library.

4.   Save the Document (the 'Document Property' listing under 'Quick Parts' will be grayed out until the document has been saved).

5.   In Word 2007, access the 'Insert' ribbon and click the drop down menu for 'Quick Parts'.

6.  Go to the 'Document Property' listing, and select your new column (repeat as needed to add other columns)

7.  Arrange fields, and add descriptions, as desired.

8.  Save the updated document locally (anyplace easy to access is fine).  We'll be using this as the template for our new content type.

9.  Go to Site Actions, Site Settings and Site Content Types to 'Create' your new content type

10.  Name etc, your new Content Type and click OK.

11.    In the next  window select the 'Advanced Settings' link, choose 'Upload a new document template' and point it to your newly downloaded file.

12.   Go back to your new library, under Settings, Document Library Settings choose the Advanced Settings  link and choose 'Yes' for 'Allow management of content types'.

13.   In the Library Settings area (under Content Types), Add from existing Content Types to select your newly created Content Type (remove the other from the list if you like)

Last-   Create a doc using the new Content Type.