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
Manpreet Singh 13Manpreet Singh 13 

Retain formatting on Visualforce page

Dear All,

I have a custom field 'Action'. It is a Long Text Area type of field. When i try to bring this field on to the visualforce page then it does not retain formatting like line spacing, line breaks etc.. Below mentioned is the code, please let me know how formatting can be retained on visualforce page as well.

 '</br>*****<h1>POS</h1>*****' +
    '</br></br>' +
    '<tr align="left"><b>POS Number: </b></tr>' + POS.Name + '</br></br>' +
    '<tr align="left"><b>Created By: </b></tr>' + + '</br></br>'+
    '<tr align="left"><b>Is this the most recent POS? </b></tr>' + POS.Most_Recent_Record__c + '</br></br>'+
     '<tr align="left"><b>Status: </b></tr>' + POS.Status__c + '</br></br>'+
    '<tr align="left"><b>Action: </b></tr>' + '<div style="word-wrap:break-word; width:450px;"/>' + POS.Action__c + '</br>';

Date Entered in
User-added image
Formatting on Visualforce page is all broken

User-added image

Try changing it from simply POS.Action__c to < apex:outputfield value="{!POS.Action__c}" />.

if that doesn't work you could also try the apex:outputtext and set escape to false