﻿# Add and set up a document template

> [HTML Version](360026936731.html)

Ready-made template files in .**docx**, .**xlsx**, and other formats are uploaded to BRIX. After that, they can be used in business processes for automatic document generation. For more information on preparing files, see [Template syntax](360027003711.md).

````
начало внимание

````
Only users included in the [Administrators](360006871932.md) group can add and edit templates.

````
конец внимание

## ````
Add a template

You can create templates:

- For the company: such a template will be available in all business processes in the system.

- Within a workspace or app: the template can only be used in processes within that a workspace or app, including if they are components of [a locked solution](block_solution.md).

````


1. ````
To create a template:

- For a company-wide template, go to **Administration** **>** **Document Templates**.

- For a workspace or an app template, click the gear icon next to its name and select **Document Templates**.

2. You will see a page with the list of available templates. To add a new one, click **+Template**.

3. In the creation window, specify the document name and add the template file. 

**(doc_template_01.png)**

The template file must contain variables that will be filled with data from the process in the future. For more information about variables and constructs used in templates, see the [Template syntax](360027003711.md) article.

4. Save the template.

## Use the document template

Let’s consider an example where you need to create an equipment purchase contract template for the Sales workspace. The template should include the name of the contractor, the name of the contact person, the type of equipment, the contract number, and the date of signing.

Create the contract in a text editor and add the corresponding variables.

**[![6.PNG](360027289212-6.PNG)]**

Save the contract to your computer and [add](360026936731.md#add_shablon) it to the **Sales** workspace.

When you upload the template, BRIX extracts the variables and displays them on a form where you can assign a specific [data type](360009707032.md) to each variable.

**(dt5.png)**

If you leave this field empty, then later in a business process you will be able to specify any type. If you select a specific type now, you will not be able to change it in the process.

After having specified the data types for your variables, click **Save**. Now you can use this template in a process, for example, in the **Fulfill purchase order** business process.

You can read more about using document templates in business processes in the [Generate from Template](360026720792.md) article.

## Edit a template

You can edit a template: modify the template's name, replace the file and change the assigned variable types. After editing, a new template version is created.

To edit:

1. On the **Document templates** page, click the file name in the templates list.

**(dt6.png)**

2. In the opened window on the **Main** tab, you can:

- Change the name of the template.

- View the content of the file by clicking on its name. The opened document will be read-only.

If you have an integration with a document editing tool integrated with BRIX that allows online editing, an **Edit** button will appear in the bottom-left corner after opening a file. Clicking it allows you to modify the document directly from the BRIX interface, which will then create a new version of the file.

- Delete a template by clicking the trash can icon to the right of its name.

- Add a new template if you have deleted an existing one.

3. If variables have changed in the new file, you will see a notification. Go to the **Variables** tab, where the list of added and deleted variables is displayed. Then specify the type of variables added or change the type of existing variables.

**(dt8.png)**



4. Click **Save** to apply changes to your template.

## Document template versions

If [structure versioning](elma365-structure-versioning.md) is enabled in your company, editing a document template automatically creates a new version of it.

To view all version changes for a template, click the three dots icon next to its name and select **Version History**. You can compare a previous version with the current one, make it active, download the template file, or delete it.