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
Yousef Bayari 7Yousef Bayari 7 

Formatting text field in Visualforce Email Template


Hello, 

 I have a custom text area field , the data stored as multiple lines,

If I use this field in a VF Email template it ignores the end of line characters and it will email it as a single line. 


Is there a way to format it in the template to look similar as it is on the object? 


Thanks 

Deepak Kumar ShyoranDeepak Kumar Shyoran
You can split method of String to separate multiple line text of a Text Area field.

For ex : 
//This will return you splited text via multiple lines
List<String> lineBy = textfld.split('\n');


Please mark it as best solution to your problem if it does solve your problem.

Yousef Bayari 7Yousef Bayari 7
will this work in VF Email Template ?
Deepak Kumar ShyoranDeepak Kumar Shyoran
Defiantly it will work. Please let me know if you will face any issue.
prathibha s 3prathibha s 3
Hi Deepak,

I am facing the same issue. Can you please elobarate the workaround you mentioned above?
You can split method of String to separate multiple line text of a Text Area field.

@ Yousef, did you find any other solution for this? 

Thanks,
Prathibha