I got a request from a customer, where they needed to add a custom address field to the head in a Word template. The address list need to come from a single source and easy to by update.
The tasks look like this:
- Create the custom address list in SharePoint. Need a multiline field, where the address with line breaks can be added.
- Content type with a Word template and custom information panel “InfoPath form”
- The InfoPath form
- Configure the document library
- The Word template
- Upload the Word template
Creating the list for the address
Create a custom list.
Adding the multiline field.
Add value to the list.
Creating the content type
I call my content type “Letter”.
Add multiline text field, to the content type. In my demo i use the build in field Address.
When done, the content type look like this. Click on the document infomartion panel settings link.
Clikc on the "Create a new custom template” link.
When InfoPath is finish loading, click on the “show field” button in the ribbon, “manage data connection” and then “Add…”.
Follow the data connection wizzard.
The locatition is the url to the SharePoint site where the custom address list is created.
The done, the new data connection is add to the data connection lists.
Change the control
Right click on the Address field textbox, select “Change Control” and select “Drop-Down List Box”.
Change the control properties
Click on the Address field and select Drop-Down List Box Properties.
Change the properties to look like this.
Change the design a bit
Remove the line break after the first horizontal region.
Publish my form
Click on the Quick Publish button, in the right top corner.
InfoPath will akes if you want to save the InfoPath template, before publish it.
Configure and add content type to document library
On the document library, go to the document library settings page and under the “Advanced settings” page, change the setting “Allow management of content types” to true.
And the “Letter” content type.
Create the Word template
Go back to the document library and create a document based on the content type. This is the easyed way to create a template with the proper field add to the Word template.
Then Word is finish loading, go to the backstage, by clicking on the “file” icon, then click on the “properties” and select “Show Document Panel”.
Go back to Word.
In my demo, i edit the header. Go the Ribbon, under the “Insert” tab, select “Quick Part”, “Document Property” and then the “Address” field.
My template ends up looking like this.
Save the document as a “dotx” file (Word template file).
Upload the template
Find the “Letter” content type, select the “Advanced settings”.
Upload the template og click on the “OK” button.
Go back to the document libary, click on the “Letter” content type in the “new document” button in the Ribbon.
Select the address in the document infomation panel.
And we are done
Post a Comment