[SalesForce] Text Wrap:Splitting of String at new line(\n)

I have following Data type Order_Description__c (Long Text Area(32768) ).We are trying to wrap this data type at new line characer.

Input Data:

Long text area as a Order_Description__c field is:

EDIORDER-SAVE COMMENTS C3 Generic LOC 0833 Expected arrival 01/07/2016 OTYPE NE TRKPC 01 GM/00007643020008361321

we tried on this direction :

Reading new line in SFDC using '\r\n' (new line characters)

this.customobj.Order_Description__c
    = EDIORDER-SAVE COMMENTS + ' \r\n' +C3 Generic+' \r\n' + LOC 0833+' \r\n' + Expected arrival 01/07/2016+' \r\n' + OTYPE NE+' \r\n' + TRKPC 01 GM/00007643020008361321;

This method has to work with when using an with an sObject field.

Expected Data :
Using \n new line break iterator — split into exact 6 lines

Like this :
EDI ORDER-SAVE COMMENTS

C3 Generic

LOC 0833

Expected arrival 01/07/2016

OTYPE NE

TRKPC 01 GM/00007643020008361321

Any help on it would be much appreciated !

Best Answer

Printing of new line character basically depends on the Datatype of the field.

Text Area / Long Text Area use "\r\n"

Rich Text Area use <br/>


Used <apex:outputField in both cases.
Related Topic