function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shweta GargShweta Garg 

Line Break in Output text Field email template

Hi All,

How to show Long text area field with Line breaks in email template
thanks.
sfdcMonkey.comsfdcMonkey.com
hi
You can try :
<apex:outputText value="Your Text" style="white-space:pre;" /> 
It will preserve the spaces .
 
alos try
 <apex:outputText value="Your Text" escape="false" />  
Thanks
i hop it helps you
Shweta GargShweta Garg
It did not work.
Here is my code :
<messaging:emailTemplate subject="test" recipientType="Contact" relatedToType="Case">
<messaging:htmlEmailBody >
Congratulations!
This is your new Visualforce Email Template.
 <html>
    <body>
    

         <apex:outputText value="{!SUBSTITUTE(SUBSTITUTE(JSENCODE(relatedTo.T_Last_External_Post__c), '\\r\\n', '\\n'),'\\n','<br/>')}" style="white-space:pre;" escape="false"  />
         
          <apex:outputField value="{!relatedTo.T_Last_External_Post__c}"/>
    </body>
    </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
nothing is working fine.
sfdcMonkey.comsfdcMonkey.com
hi Shweta Garg
Please go to below link for same issue i hop it helps you
https://developer.salesforce.com/forums/?id=906F0000000ApSCIA0
Thanks :)
Joey WeemsJoey Weems

For anyone reading this like I just did I can confirm that the solution presented by (Piyush_soni__c) of:

<apex:outputText value="Your Text" style="white-space:pre;" /> 
It will preserve the spaces .
 
alos try
 <apex:outputText value="Your Text" escape="false" />


Works if you combine the two as such:

<apex:outputText value="Your Text"
style="white-space:pre;"
escape="false"
/>