For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quick Setup: Conditional Logic With Microsoft Templates (DOCX, PPTX, XLSX)

Learn how to use RENDER statements in DOCX templates with bracketed Microsoft template syntax.

Quick setup for conditional logic in DOCX templates

Conditional logic works in DOCX templates.

The logic stays the same.

The wrapper changes.

In DOCX, wrap each RENDER tag in square brackets.

Use DOCX merge fields inside the content you want to output.

Basic pattern

[<!--RENDER=logical_expression -->]
  content to show if expression is true
[<!--ENDRENDER-->]

Basic example

Use this pattern when the condition checks one field and the output shows another.

[<!--RENDER='{{!Opportunity.StageName}}' == 'Closed Won' -->]
  Closed amount: [{{!Opportunity.Amount #,###.##}}]
[<!--ENDRENDER-->]

The field inside the condition stays in standard merge syntax.

The visible output field uses DOCX merge syntax.

Use square brackets around the opening and closing RENDER tags.

Use square brackets around any merge field that should print in the DOCX output.

AND and OR logic

Use parentheses around combined conditions.

AND

OR

Nested conditional logic

You can nest up to 4 levels deep.

Use a distinct tag for each nested level.

Do not skip levels.

Two levels

Three levels

CONTAINS and NOT CONTAINS

Use CONTAINS when you need a partial text match.

Use NOT CONTAINS for the inverse.

When to use template logic

Best for

  • Showing or hiding sections based on field values

  • Reusing one DOCX template across multiple scenarios

  • Keeping document rules inside the template

Less ideal for

  • Very large content blocks controlled by simple rules

  • Logic that already exists in formula fields or automation

Last updated

Was this helpful?