Content Types for Document Templates
  • 29 Feb 2024
  • 3 Minutes to read
  • Dark

Content Types for Document Templates

  • Dark

Article Summary

Use content types to create templates for generating employee documents or job contracts. A template can contain automatic fields from the content type that are filled in with the employee data in the generated document. The article describes creating content types for the Employee Documents library. In the same way, they can be created for the Job Contracts library.

Create Content Type

Follow these steps to create a new content type:

  1. Under Setting > SharePoint Settings > Web Designer Galleries, click Site content types.
  2. Next, click Create
  3. Provide the content type name and description.
  4. Select a group from which parent content type will be selected. Then select a parent content type the current type will be based on. The initial set of fields for content type will be taken from the parent type.
  5. Select a group the content type will belong to (select an existing group or create a new one).
  6. Click OK to save your content type. 

Add Content Type to Doc Library

The next step is to add the newly created content type to a document library it will be used for.

  1. Go to Settings > Site Lists and Libraries and locate the document library the content type will be added to. 
  2. Click the library name and on the page that opens, click the Library tab and then Library Settings
  3. Next, click Add from existing site content types
  4. Select the previously created type and click Add
  5. Click OK. The content type will be added to the library. 

Add Fields to Content Type

After the content type has been added to the document library, add fields to it.

  1. In the document library settings, under Content Types, click the name of the created content type
  2. On the page that opens, click Add from existing site or list columns.
  3. Select the columns to be used for content type (you'll be able to add them as automatic fields to your document templates) and click Add and then OK.

Add New Columns to Doc Library

If the columns you would like to add are missing in the document library, add them to the library. Any columns from the Employees and Salary Details lists can be added. To add a column, follow these steps:

  1. First of all, you'll need the internal name of the column you'll be adding, since it is specified when creating a column. To check it, open the Employees (or Salary Details) list from Settings > Site Lists and Libraries and click the name of the column you'll be adding. The address bar will contain its internal name. Copy it. 
  2. Return to the Employee Documents library settings (Settings > Site Lists and Libraries > Employee Documents and on the Library tab, click Library Settings). Next, click Create column
  3. In the Column name field, paste the the internal name you copied. If you are adding a lookup field and want the field value instead of ID to be displayed on your documents, type _Value after the column name and set the column type to Single line of text. For example, if you add the Employee field and in the Column name, specify Employee, the employee ID will be displayed in the documents where it is used as automatic field. If you add Employee_Value, the employee name will be displayed. For the fields of the other types, just type in the internal name and select the column type as in the original list.
  4. Click OK. If the Add to all content types check box is selected, the column will be added to your content type automatically. 
  5. Make sure that all the required columns have been added to the content type (for Employee Documents, it is Employee, Document Type, Employee Access, Manager Access).

Create Document Template

Now it's time to create a document template and insert the content type columns as automatic fields to be filled in with data in the generated documents.

  1. In the content type settings (under Settings > Site Lists and Libraries select Employee Documents and click Library > Library Settings, under Content Types, click the content type name), click Advanced settings.
  2. Click Upload a new document template, browse for a file to be used as template and click OK. Please note that template must be in the .docx format. Next, click Edit Template to add automatic fields to the uploaded file. 
  3. Next, click Edit Template
  4. When the template opens, click Insert > Quick Parts > Document Property and select a field to be inserted.
  5. In the same way, insert all the fields you want to be automatically filled in. 
  6. Save the template.

Generate Document based on Template

When the template is ready, the documents can be generated based on it.

  1. Open an employee card and click Documents

Select the content type you created and click GenerateThe file will be generated.

and automatic fields filled in. 

Was this article helpful?