> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tela.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Build .docx Templates

> Learn how to create Word document templates with placeholders for automated document generation.

## Overview

Tela's Document Templater allows you to generate documents from `.docx` templates by replacing placeholders with dynamic values from your workflow. You create a template once, and Tela fills in the data every time the workflow runs.

## How Placeholders Work

Placeholders are markers inside your `.docx` template that tell Tela where to insert values. They use curly braces with the placeholder name:

```
{placeholder_name}
```

When the document is generated, each `{placeholder_name}` is replaced with the actual value you mapped in the workflow.

### Example

A template with:

```
Dear {client_name},

Your invoice number is {invoice_number}, with a total of {total_amount}.

Best regards,
{company_name}
```

Will produce:

```
Dear John Smith,

Your invoice number is INV-2026-001, with a total of $1,500.00.

Best regards,
Acme Corp
```

## Creating a Template

<Steps>
  <Step title="Create a .docx file">
    Open Microsoft Word, Google Docs (export as .docx), or any editor that supports the `.docx` format.
  </Step>

  <Step title="Write your content">
    Write the document content as you normally would — formatting, tables, headers, images, and styles are all preserved.
  </Step>

  <Step title="Add placeholders">
    Where you want dynamic values, type the placeholder name wrapped in curly braces: `{placeholder_name}`.

    Use descriptive names like `{client_name}`, `{contract_date}`, or `{total_value}`.
  </Step>

  <Step title="Save as .docx">
    Save the file in `.docx` format. Other formats (`.doc`, `.pdf`, `.odt`) are not supported.
  </Step>
</Steps>

## Rules for Placeholders

| Rule                    | Example                                          | Notes                             |
| ----------------------- | ------------------------------------------------ | --------------------------------- |
| Use curly braces        | `{name}`                                         | Single curly braces only          |
| No spaces inside braces | `{client_name}`                                  | Use underscores instead of spaces |
| Case sensitive          | `{Name}` and `{name}` are different placeholders | Be consistent                     |
| Can repeat              | Use `{company}` multiple times                   | Same value is inserted everywhere |
| Works in tables         | Place `{value}` inside table cells               | Formatting is preserved           |

## Using Templates in Workflows

1. Add a **Generate Document** node to your workflow
2. Upload your `.docx` template
3. Tela automatically extracts all placeholders from the template
4. Map each placeholder to a workflow variable or a previous step's output
5. Set the output filename
6. Run the workflow — the generated document is available as output

## Tips

<CardGroup cols={2}>
  <Card title="Keep placeholders simple" icon="lightbulb">
    Use short, descriptive names. Avoid special characters other than underscores.
  </Card>

  <Card title="Test with sample data" icon="flask">
    Before using in production, run the workflow with test values to verify formatting.
  </Card>

  <Card title="Preserve formatting" icon="paintbrush">
    Placeholders inherit the formatting (bold, italic, font size) of the surrounding text.
  </Card>

  <Card title="Use tables for structured data" icon="table">
    Place placeholders inside table cells for invoices, reports, or forms.
  </Card>
</CardGroup>
