Help Center Navigation
Word Templates

Scalar Variables & Placeholders

Master the {{ variable_name }} placeholder syntax in Microsoft Word documents, character conventions, case-insensitivity, and formatting.

4 min read • Guide

Trydoku allows you to turn any standard Microsoft Word (.docx) document into a dynamic automation template. By embedding double-curly-brace placeholders, you designate exact positions where data from your spreadsheets or API payloads will be merged.

Scalar Variable Syntax

Scalar placeholders replace single text values, dates, or numbers. Wrap your variable name in double curly braces:

{{ variable_name }} Word text placeholder

Naming Conventions & Character Rules

  • Alphanumeric & Underscores: Variable names should use letters, numbers, and underscores (e.g. {{ client_name }}, {{ invoice_date }}, {{ total_amount }}).
  • Case-Insensitivity: Variable matching is case-insensitive. A placeholder written as {{ Full_Name }} will seamlessly match a spreadsheet column header named full_name.
  • Automatic XML Escaping: Special characters such as &, <, and > inside your replacement data are automatically encoded into safe XML entities, preventing DOCX corruption or malformed document errors.

Preventing Word "Split XML Run" Issues

Microsoft Word often splits typed text into multiple underlying XML nodes (called <w:r> runs) whenever you edit, backspace, or apply formatting midway through typing a word. If {{ is in one XML run and name}} is in another, naive regex parsers fail to find it.

How Trydoku Handles Fragmented Runs

Trydoku's template engine automatically inspects the full document XML tree and normalizes fragmented runs, ensuring placeholders are recognized reliably even if heavily edited in Word.

Best practice tip: When authoring templates in Microsoft Word, type your placeholder name in Notepad or your text editor first and paste it in as unformatted text, or select the entire placeholder and apply styling uniformly.

Applying Styles to Variables

Whatever typography, color, font size, bolding, or alignment you apply to the placeholder in Word will be inherited by the inserted data. If {{ client_name }} is styled as 14pt Bold Blue Arial, the generated client name will carry that exact styling.

Put this into practice

Ready to take action or test what you've learned?

View Sample DOCX →