Lists in SharePoint are a very convenient way to store and share information. Now with SharePoint 2010, InfoPath form customization has made it much easier to create tailor-made forms for input and display of SharePoint list data. But when it comes to printing an individual list item in a manner which many companies still require, SharePoint 2010 does not have the tools available out-of-the-box. But with a little bit of work using Word and InfoPath a very user-friendly but powerful solution can be created. Here are the steps you will need to follow.
- Your starting point is the list which contains your information in SharePoint. In this example, it is a simple list called costs with four columns.
Name (a simple text column, which was the default Title column of the list),
Country of Origin (a choice column providing a list of countries),
Family (a numeric column constrained to values between 0 and 5),
Signed-Off (a Yes/No column).
- Next step is to create a Site Content Type, (Site Settings, Site Content Types, Create) based on the Document content type. In this example, the new Content Type is called Print-Item.
- You will need to create New Site Columns which match the names of columns in your list and add them to the Print-Item content type.
- Next up, design a Word template laid out in a manner that you would like to use for printing your list information. This could take the form of the example below:
- Save this Word file as a template somewhere (e.g. mydemotemplate.dotx) and then upload it to your new Print-Item content type under Advanced settings.
- Now create a new document library called Print and add your new Print-Item content type, after changing the Advanced settings to allow for the management of content types.
Once the Print-Item content type is available, you can hide the default Document content type, by clicking on the Change new button order and default content type link and unchecking the Visible check-box.
- Now when you create a new document in the document library, you should see your Word template as designed earlier. If you display the Document Information Panel (File, Info, Properties, Show Document Panel), you will see your site columns associated with the content type:
- Now you can insert these into the document using Insert, Quick Parts, Document Properties and chose the appropriate document property for each column in your list:
Then save your Word file again as .dotx template and upload it to your Print-Item content type once more. - You are now in a position to edit the Document Information Panel which is associated with the Print-Item content type and link it to your list rather than the document library. Fire up InfoPath and choose the Document Information Panel template:
Then enter the URL for your SharePoint site and choose the Print-Item content type:
- Next right-click the Title field and Change Control to a Drop-Down List Box. Then right click Title again and choose Drop-Down List Box Properties. Select Get Choices from an external data source, then Add and create a new connection to Receive data from a SharePoint list. Then select your list.
- Then select the columns you require from your SharePoint list.
Once you have finished your Drop-Down List Box properties should appear as follows:
- Check using the Preview in InfoPath that the Drop-Down is picking up the items from your list.
- Next you will need to create as Rule for each of the other columns that you want to display in your Word file for printing. You do this by right-clicking the Drop-Down List Box, Rules, Manage Rules and add a new rule as an Action. The required action is to Set a field’s value:
Choose from the Main data source, under properties, document management, in this case the first of our additional fields, Country of Origin.
For the value of the field, click the browse button and select Insert Field or Group and switch to the Secondary data source, which in our example is our list called Costs:
Then select the appropriate data field, in this case Country of Origin, and then click on the Filter Data… button.
Click Add and then select the Name field as follows:
making it is equal to the title field in the coreProperties of the Main data connection.
- This is probably a good point to make sure you have saved your InfoPath form and then click Preview to check that when you select from your Drop-Down List, the next field is populated correctly according the information in your SharePoint list.
- Repeat the procedure and create a new rule in exactly the same fashion as described above for each additional field you require. It may seem cumbersome at first, but once you get into the swing of it, you will race through the process. Just make sure you get the right data connections each time. It is a good idea to preview after each field to verify that all is correctly configured.
- When done, publish the newly customized document information panel to SharePoint and when you create a new document from in the Print library, you should be able to choose the item you want to print from your list, and see the information appear, as if by magic in your Word file:
- As my example shows, it is also worth checking the format of your display information too, as you could be forgiven for thinking I have several thousand children if you do not notice the decimal point.
Leave a Reply