I have a rich text area custom field on custom object and I am trying to convert it to long text area fields but when i exported the data using data loader,I see lot of html tags.Is it possible to restore exact formating in long text area field
2 Answers
If you just change the Field Type from Rich Text to Long Text, Salesforce will take care of stripping out HTML tags while converting line breaks into new lines.
Just go to Setup and find your field, then click "Change Field Type".
When you select "Text Area (Long)", Salesforce will present a "Field Conversion" screen which asks you what you want to do with the HTML markup:
Select "Remove the HTML Markup. Only the content will be kept" , and click OK. Click Save.
I have tested this conversion, and it worked exactly as expected --- line breaks were converted into newlines, while all other HTML tags were stripped out and ignored. I had a Rich Text field, and for one of my records, the value looked like this:
And after converting the field to a Long Textarea, the value of the field for this record looks like this:
a more simple and best solution would be to add the css pre-wrap which conserves New lines, Spaces and tabs, Text wrapping
<apex:outputtext style="white-space:pre-wrap;" value="{!donationText}" escape="false" /><br />
Please note donationText is a long text area