# Manage and Build Templates

The Manage and Build Templates section is where you can upload your .docx templates for exporting. [Click here for an overview of this feature.](/blocworx-documentation/bloc/pdf-and-doc-file-templates.md)

To summarise, you can populate and export a word or pdf file with images, data lists and content and field values simply by referencing the field slug, e.g. a field called My First field would be filled as ${my\_first\_field} in the word doc.&#x20;

### Create Mockup

By Clicking "Generate Mockup" you can get a .docx file that contains all your field slugs.

### Show Export Links in Data Results

This is a feature that allows you to export the file straight from the Data results.

![](/files/VFsNfYqQ2sgp0mItaNcN)

### Upload Template

You can upload as many templates as you like and they will be available to choose from in the front end of the bloc.

{% hint style="info" %}
Template files **must** be .docx files
{% endhint %}

### Template List

Once your templates are uploaded, they will appear in the Template List where they can downloaded or deleted.

### Using the Template Builder: Tips & Tricks

#### Standard field value population

By using the field slug in this format on the document the value will replace this field: ${my\_first\_field}.&#x20;

#### WYSIWYG for User Fields

These fields contain html and this html will correctly convert and populate your word file.

#### Image and File Fields

Images will successfully appear in the word doc. You can also adjust the image size by adding numbers into the variable, for example: ${my\_image\_field:200:100} where 200 is the width and 100 is the height.

#### Digital Signatures

Digital Signatures will successfully populate into the file.

#### Sub Bloc and Results Box Fields

There is an advanced feature within this overall feature, where you can display lists of data in a table if the field is either a [Sub Bloc](/blocworx-documentation/bloc-editor/fields-tools-and-charts/sub-blocs-tools-components/sub-bloc.md) or a [Results Box](/blocworx-documentation/bloc-editor/fields-tools-and-charts/charts-results-and-data-feeds/results-box.md). It displays the data from the these external blocs instead of the data in the main parent bloc that you are exporting the document from.\
\
It works by using the filters you have set out in those fields as a means of finding the data to display.\
\
You can see this in action in this [How to Video from 18 minutes onwards](/blocworx-documentation/how-tos/untitled/build-a-simple-invoicing-system.md).

{% hint style="success" %}
Having a field in the child Sub Bloc that is the same name as a field in the parent bloc can cause the system to not understand which one to use, and a result either the table of data may not appear, or the parent field will be blank. It is possible to distinguish between the two by simply adding \[parent] to the field slug in the doc file. \
\
E.g. ${\[parent]my\_first\_field}\
\
By doing this the system will be able to distinguish between the two fields even if they have the same name.<br>

There is also a second way these can be distinguished. You can add the field slug of the Results Box field itself before the field slug that you are loading.\
\
E.g Supposing you have a Results Box field called Invoice Line Items and its slug is invoice\_line\_items.\
\
You can be explicit about what field you are loading by adding this slug followed by a hyphen, in this example the Model Number might be model\_number as part of a line item.\
\
${invoice\_line\_items-model\_number}
{% endhint %}

#### Euro auto formatting

If you append \[euro] to a field it will format it to a euro format\
\
e.g. ${\[euro]total\_cost} , if that value was 234\
\
the output will be €234.00

#### Field Slug Population Feature

You can actually insert field slugs in the value of a field in a bloc and if you append \[blcx\_slug\_population] it will process these first before it does all the fields without this. It's a way to put field slugs inside field slugs.<br>

An example might be where you want a different data set entirely being populated into the one place.\
\
Example, some invoices want a Finance Company address, and others want a Customer address\
then using existing Blocworx features you could populate a field like "address" with actual field slugs\
\
So the **address** field could have a value: "${finance\_company\_name}, ${finance\_company\_address}"\
In a different situation the address field might have a value: "${customer\_name}, ${customer\_address}"

\
In your template if you do the following\
\
${\[blcx\_slug\_population]address}\
\
It will populate the value, e.g. ${customer\_name}, ${customer\_address}\
\
These  populated fields will now get processed normally as if they had been put in the template manually.

#### Dynamic Line Breaks

If the value in your field has \[BLCX\_LINE\_BREAK] it will automatically create a line break in the value.\
E.g. if you have a merge field that results Hello\[BLCX\_LINE\_BREAK]World, it will appear in the template as \
\
Hello\
World\
\
This also works with the dynamic field slug population feature described above.

#### Conditionally Show content if field exists or not

You can decide to show something in the doc based on whether another field has a value or not\
\
${\[blcx\_if]-saying\_hi\[thenshow]='Hi'}\
\
in this example, if saying\_hi is there, and is not equal null or N/A then it will show a Hi.\
If its not there, or if its there but equal N/A or null, it won't show anything.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.blocworx.com/blocworx-documentation/bloc-editor/bloc-settings/manage-and-build-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
