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
suresh.csksuresh.csk 

CR + LF in csv files while exporting

Hi.

I can export the csv file with line feed('\n').

How to export with CRLF ('\r\n').

 

any idea greatlt appreictaed

regards

suresh

nickwick76nickwick76

Hi,

You can't add '\r\n' manually unfortunately to get those line breaks.

If you work in Notepad++ and 'Show All Characters' you will see that these characters will be created by default.

However if you want to control it you can do that from Excel for example. In this case the CHAR function will do it for you.

 

Use this formula:

CONCATENATE(A1;CHAR(10);B2);

 

This will give you a result with the content in cell A1 on one row and the content of cell B2 on the next row.

Then you just save as CSV and import it to Salesforce. 

You probably need apostrophes around the result before inserting it to Salesforce but you should get that automatically while saving as a CSV.

 

HTH / Niklas 

suresh.csksuresh.csk

Hi.

 

Thanks for the reply.

I want to export the csv file using VF.

So done something like this in the apex list and I return the list to VF

 

csvData = "Name" + ",Address" + '\r\n';

 

VF renders as csv and '\r\n' is not working.

Any idea

 

thanks

suresh

 

nickwick76nickwick76

Take a look at this post and see if it helps. It seems as if you use outputField or outputText you get the behaviour you are after .-> http://stackoverflow.com/questions/10083472/newline-character-on-text-area

 

// Niklas

suresh.csksuresh.csk

Hi Niklas

 

Thanks for the reply.

 

cheers

suresh