Conditional Logic In Microsoft Templates (DOCX, PPTX, XLSX)
Use the correct square-bracket syntax for RENDER blocks and merge fields in DOCX templates.
Use this page when your RENDER statement works in the HTML editor but needs DOCX syntax.
The logic stays the same.
The wrapping syntax changes.
Core rules
Wrap opening and closing
RENDERtags in square brackets.Keep the logical expression inside the
RENDERtag.Wrap merge fields in DOCX content with square brackets.
Basic pattern
[<!--RENDER='{{!Opportunity.StageName}}' == 'Closed Won' -->]
This opportunity is closed won.
[<!--ENDRENDER-->]Show conditional content with a merge field
Use square brackets for the merge field inside the rendered content.
[<!--RENDER='{{!Contact.Phone}}' != 'NULL' -->]
Phone number: [{{!Contact.Phone}}]
[<!--ENDRENDER-->]Use AND and OR
&&, ||, and parentheses work in DOCX too.
Use nested render blocks
Nested render blocks follow the same naming rules as standard templates.
Common fixes
Blank output: Make sure both the opening tag and the closing tag use square brackets.
Field prints as text: Use
[{{!FieldName}}]in DOCX content.Nested logic fails: Match
RENDER1withENDRENDER1,RENDER2withENDRENDER2, and so on.Expression is hard to debug: Test the logic in a standard template first. Then convert the outer wrapping for DOCX.
Keep going
Review Conditional Logic Structure for base syntax and supported operators
Review Conditional Logic Working Examples for reusable patterns
Review Named Queries in DOCX and PPTX if your DOCX template also uses query-based data blocks
Last updated
Was this helpful?

