Wednesday, September 12, 2012

Custom document infomartion panel, InfoPath form as letter selector

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:

  1. Create the custom address list in SharePoint. Need a multiline field, where the address with line breaks can be added.
  2. Content type with a Word template and custom information panel “InfoPath form”
  3. The InfoPath form
  4. Configure the document library
  5. The Word template
  6. Upload the Word template
  7. Test


Creating the list for the address

Create a custom list.

1.1

Adding the multiline field.

1.2

Add value to the list.

1.3

Creating the content type

I call my content type “Letter”.

2.1

Add multiline text field, to the content type. In my demo i use the build in field Address.

2.2

When done, the content type look like this. Click on the document infomartion panel settings link.

2.3

Clikc on the "Create a new custom template” link.

2.4

InfoPath view

When InfoPath is finish loading, click on the “show field” button in the ribbon, “manage data connection” and then “Add…”.

3.1

Datasource wizzard

Follow the data connection wizzard.

3.2.1

3.2.2

The locatition is the url to the SharePoint site where the custom address list is created.

3.2.3

3.2.4

3.2.5

3.2.6

3.2.7

The done, the new data connection is add to the data connection lists.

3.2.8

Change the control

Right click on the Address field textbox, select “Change Control” and select “Drop-Down List Box”.

3.3

Change the control properties

Click on the Address field and select Drop-Down List Box Properties.

3.4.1

Change the properties to look like this.

3.4.2

Change the design a bit

Remove the line break after the first horizontal region.

3.5

Publish my form

Click on the Quick Publish button, in the right top corner.

3.7.1

InfoPath will akes if you want to save the InfoPath template, before publish it.

3.7.2

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.

4.1.1

And the “Letter” content type.

4.1.2

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.

5.1

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”.

5.2

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.

5.3

My template ends up looking like this.

5.4

Save the document as a “dotx” file (Word template file).

5.5

Upload the template

Find the “Letter” content type, select the “Advanced settings”.

6.1

Upload the template og click on the “OK” button.

6.2

The test

Go back to the document libary, click on the “Letter” content type in the “new document” button in the Ribbon.

5.1

Select the address in the document infomation panel.

7.1

And we are done Smiley

No comments:

Post a Comment