How to add line break in richtextarea field

I have a requirement to implement a user email signature in visualforce email template,and i have tried this code {!$User.Email_Signature_Rich__c} it’s appering without line breaks in signature.How to add line break in rich text area field.
enter image description here

Email_Signature_Rich__c is Richtextarea field.

E.g. it shows

Test, Queensland, AUS

i want to show like this

Test, 
Queensland, 
AUS


<messaging:emailTemplate subject=" Query Notification – DC: {!relatedTo.Distribution_Centre__r.DC_Number__c} - Vendor - {!relatedto.Vendor_Number__r.Vendor_Number__c} {!relatedto.Vendor_Number__r.Name} " recipientType="User" relatedToType="Case">

<messaging:htmlEmailBody >
<html>
      <body>
        <STYLE type="text/css">
          TH {font-size: 11px; font-face: arial;background: #CCCCCC;
               border-width: 0;  text-align: center } 
          TD  {font-size: 11px; font-face: verdana } 
          TABLE {border: solid #CCCCCC; border-width: 0}
          TR {border: solid #CCCCCC; border-width: 5}
        </STYLE>
        <font face="arial" size="2">

          <p>Hi {!recipient.name},</p>
          <p>The below DC Receiving Query has been received and requires action:</p>

<table colunm = "6" border = "5">
            <tr > 

               <th>PO Number(s)</th>
               <th> Buyer Name</th>
               <th> Event Number </th>
               <th> Container Number </th>
               <th> Number Pallets / Cartons </th>
               <th> PO Line Item </th>
               <th> Keycode </th>
               <th> Booking Date / Time</th>


            </tr>
            <apex:repeat var="cx" value="{!relatedTo.Big_W_Case_PO__r}">
              <tr>                
              <!--<td><c:Email_DC_Receiving thiscaseId="{!relatedTo.id}" /> </td>--> 
               <td>{!cx.PO__r.Name}</td>
                <td>{!cx.PO__r.Department_Team__r.Name}</td>
                <td>{!cx.PO__r.Event_Number__c}</td>
                <td>{!cx.PO__r.Container_Number__c}</td>                
                <td>{!cx.PO__r.Number_Pallets_Cartons__c}</td>
                <td><c:Email_DC_Receiving_PoLineItem thiscaseId="{!cx.id}" /> </td>
                  <td><c:Email_DC_Receiving_Keycode thiscaseId="{!cx.id}" /> </td>  

                <td><c:BIG_W_Locale_FormatDateTime date_Timevalue="{!cx.PO__r.Booking_Date_Time__c}"/></td>
              </tr>

            </apex:repeat>

            </table>                    



              <b> Kind Regards,</b><br/>
            <!--  {!$User.Email_Signature_Rich__c}-->
           <apex:outputField value="{!recipient.Email_Signature_Rich__c}"/>     
    </font>
      </body>
    </html>
</messaging:htmlEmailBody>


</messaging:emailTemplate>

Answer

The solution would to use OutputField so that formatting stays rather than simple merge field

<messaging:emailTemplate subject="helo" recipientType="User" relatedToType="Case">
<messaging:htmlEmailBody >
  <apex:outputField value="{!recipient.Email_Signature_Rich__c}"/>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Attribution
Source : Link , Question Author : user7292 , Answer Author : Mohith Shrivastava

Leave a Comment