Why does an extra space appear before punctuation (like a semicolon) in an Apsona merge template using IF/ELSE logic, and how can it be fixed?

This issue occurs due to how Microsoft Word handles punctuation placed outside conditional merge fields. When punctuation (such as a colon) is added after an «ENDIF» statement, Word treats it as a separate element and may introduce an extra space between the merged value and the punctuation in the final output.

For example, using:

Dear «IF NonEntityContactName»«NonEntityContactName»«ELSE»«SALUTATION»«ENDIF»:

can result in an unwanted space before the colon.

The recommended approach is to include the punctuation inside the conditional logic instead of placing it after «ENDIF». For example:

Dear «IF NonEntityContactName»«NonEntityContactName»«ELSE»«SALUTATION»:«ENDIF»

This ensures that the punctuation becomes part of the resolved merge output, preventing any extra spacing. When working with IF/ELSE/ENDIF blocks in Word templates, always include punctuation within the merge logic to avoid formatting issues in the final document