Advanced Tags Reference

Syntax reference for content controls, dynamic colors, table-cell merge, and list numbering restart in Wordize templates.
What is this page about?

This page documents specialized syntax tags that are commonly used in production templates beyond loops and conditionals.

It covers content-control tags, coloring tags, dynamic table merges, and list numbering reset.

Let’s look at some commonly used specialized syntax tags that are typically used in templates.

Working with Content Controls

Use these tags in the title of a Word content control. Wordize reads the tag at runtime and updates the control instead of leaving the tag text in the document.

The two common cases are checkbox controls and list controls:

  • check updates a checkbox state from a Boolean expression
  • item adds one option to a combo box or dropdown list

Checkbox value

Syntax:

<<check [conditional_expression]>>

Place this in a checkbox content-control title to set checked/unchecked state at runtime.

Use a Boolean expression such as <<check [traveler.IsVip]>>. When the expression is true, the checkbox is checked; when it is false, the checkbox is cleared.

Combo box / dropdown items

Place item tags in the title of a combo box or dropdown list content control. Each item tag adds one option to that control when the report is built.

Syntax:

<<item [value_expression] [display_name_expression]>>

Examples:

<<item ["STD"] ["Standard fare"]>>
<<foreach [fare in fares]>><<item [fare.Code] [fare.Name]>><</foreach>>

If display_name_expression is omitted, value text is used for display.

Use item tags in either of these ways:

  • Add a few fixed items directly in the content-control title
  • Generate items from a collection with foreach when the list must come from data

Example content-control title:

<<item ["STD"] ["Standard fare"]>><<item ["PRM"] ["Premium fare"]>>

Example generated from data:

<<foreach [fare in fares]>><<item [fare.Code] [fare.Name]>><</foreach>>

In both cases, the tags are written in the content-control title, not in the visible body text of the document.

Content Control Titles

You can also place a normal expression tag in a content-control title when you only need a dynamic caption.

Example:

<<[traveler.FullName]>>

This replaces the title text with the current value of the expression during report generation.

Setting Text and Background Color Dynamically

Use color tags to format inline content during report generation. The opening and closing tags define the range of text that receives formatting.

Text color tag

Syntax:

<<textColor [color_expression]>>
content_to_color
<</textColor>>

Example:

<<textColor [traveler.IsVip ? "DarkGreen" : "Black"]>><<[traveler.FullName]>><</textColor>>

Background color tag

Syntax:

<<backColor [color_expression]>>
content_to_highlight
<</backColor>>

Supported color expression forms:

  • Color name string such as "Red"
  • HTML hex string such as "#F08080"
  • Integer RGB value such as 0xFFFF00
  • Color value from application code

Example:

<<backColor [traveler.HasConnectionDelay ? "#FFE08A" : "Transparent"]>><<[traveler.StatusNote]>><</backColor>>

Merging Table Cells Dynamically

Syntax:

<<cellMerge>>
<<cellMerge -horz>>
<<cellMerge -both>>
<<cellMerge [expression]>>

Behavior:

  • Default direction is vertical
  • -horz limits merging to horizontal
  • -both allows both directions
  • Cells are merged only when adjacent displayed text values are equal
  • The optional expression acts as an additional merge key

What <<cellMerge [expression]>> means:

  • Wordize first checks visible text equality in adjacent cells (after trimming spaces)
  • If an expression is provided, Wordize also compares expression values
  • With an expression key, cells merge only when both are equal: cell text and expression value

Use this to prevent accidental merging across different groups that happen to show the same text.

Table Example 1: Merge rows with the same invoice number

Template table row (Invoice column is merged when invoice numbers repeat):

| Invoice | Item |
| <<foreach [item in items]>><<[item.InvoiceNumber]>><<cellMerge>> | <<[item.Name]>><</foreach>> |

Sample data:

Invoice Item
11342 Water
11342 Tea
15385 Water

Result:

Invoice Item
11342 Water
Tea
15385 Water

Why this works: adjacent rows share the same invoice number (11342), so the Invoice cells merge vertically.

Table Example 2: Prevent merge by expression key

Template row:

| Invoice | Item |
| <<foreach [item in items]>><<[item.InvoiceNumber]>><<cellMerge [item.Name]>> | <<[item.Name]>><</foreach>> |

Here, item.Name is used as the merge key. Even with the same invoice number, rows with different items do not merge.

Result with expression key:

Invoice Item
11342 Water
11342 Tea
15385 Water

Table Example 3: Horizontal and both-direction merge

Template snippets:

<<cellMerge -horz>>
<<cellMerge -both>>

Use -horz when repeated values appear across columns in the same row. Use -both only when you intentionally want merges in both axes and your table design is prepared for complex spans.

Restarting List Numbering Dynamically

Syntax:

<<restartNum>>

Typical usage:

<<foreach [order in orders]>>
Order: <<[order.Id]>>
1. <<restartNum>><<foreach [service in order.Services]>><<[service.Name]>>
<</foreach>>
<</foreach>>

Expected behavior:

  • Numbering restarts for each order block when placed in the numbered paragraph before the inner foreach region

Result:

Order: SO-1001

  1. Airport transfer
  2. Hotel check-in

Order: SO-1002

  1. City tour
  2. Dinner reservation
  3. Return transfer
Important to note:
For maintainability, keep one advanced behavior per paragraph/row at first, confirm output, then combine tags incrementally.