Make the document react to the data: red overdue dates, warning banners that only appear when relevant, values styled by condition.
{#field | test} ... {/} renders its contents only when the test passes;
{^field | test} ... {/} renders only when it FAILS.
The big red banner that appears only for overdue quotes:
{#Opportunity.CloseDate | ispast}⚠ PAST DUE ⚠{/}
Style the whole thing (30pt, bold, red) in your template — when the close date isn't past, the entire paragraph vanishes from the output.
The same pattern hides/show anything: a discount paragraph only when
{#Opportunity.Discount__c}...{/} has a value, a renewal notice only for
past dates, alternate wording for the false case with {^...}.
Combine a section with dynamic style filters:
Close date: {#Opportunity.CloseDate | ispast}{Opportunity.CloseDate | dateformat("%B %d, %Y") | color("red") | bold}{/}
{^Opportunity.CloseDate | ispast}{Opportunity.CloseDate | dateformat("%B %d, %Y")}{/}
Read it as: if past → date in red bold; otherwise → date normal. The same trick powers a grand total that's red when overdue, blue otherwise:
{#Opportunity.CloseDate | ispast}{Opportunity.Amount | currency | color("red") | bold}{/}
{^Opportunity.CloseDate | ispast}{Opportunity.Amount | currency | color("blue") | bold}{/}
Chainable, applied at merge time (they override the template's static formatting for that value):
| Filter | Effect |
|---|---|
\| bold |
bold |
\| italic |
italic |
\| underline |
underline |
\| color("red") |
text color — names (red, blue, green…) or hex (color("C00000")) |
\| highlight("yellow") |
highlight |
| Test | True when |
|---|---|
\| ispast |
the date is before today |
| (bare field) | the field has any non-empty value |
{#Opportunity.NextStep}Next step: {Opportunity.NextStep}{/} prints the
line only when Next Step is filled in — the cleanest way to avoid orphaned
labels next to blank values.
Import the starter library and open Quote (past-due formatting) — it uses every technique on this page. Generate it against a record with a past close date, then a future one, and compare.
color("red") — see Working with Word
templates.{/} — nothing inside.