3

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

  • To clarify, do you want the Long Text Area field to contain just text, with all HTML tags stripped out? – zachelrath Apr 17 '15 at 17:51
  • Is it possible to restore text and new line and some html tables and strip the rest of html – sfdc Apr 17 '15 at 17:53
6

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:

Field Conversion screen

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:

Original Rich Text

And after converting the field to a Long Textarea, the value of the field for this record looks like this:

Long Text after conversion

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.