My Account | Internet Creations
Welcome, Guest.

Preserving comment spacing and line breaks in HTML emails (Visualforce and Custom)


Case Comments are text only fields and don't merge well in HTML email templates. When you try to merge a text field with special spacing and line breaks, they will be lost because HTML requires tags to accomplish such formatting.


For example, you may have the following comment:
Step 1...
Step 2...
Step 3...
But when merged into an HTML template, the result may look like:
Step 1...Step 2...Step 3...

In an HTML/Custom template, you can use a basic CSS SPAN tag to preserve the "white-space" in your text-only merge field.  For example:
<span style="white-space:pre;"> 
For more information on this tag, visit
In a Visualforce template, you can use apex:outputField to preserve the "white-space" in your text-only merge field. For example:
<apex:outputField value="{!relatedTo.E2CP__Most_Recent_Public_Comment__c}"></apex:outputField>


Open a Case