Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a data table in which it contains various rows an columns.
In one column i have append \n between two words to get it in a new line.
Then i assign this data table to a grid view data source and binding it,Later
i have exported this grid view to a excel file.My problem is that the newline(\n)
is not reflecting in the excel file.So please help in this or guide me to put a new line in excel file while exporting it via C#.

Thanks & Regards
Somu Jose
Posted
Comments
Member 11606892 22-Apr-17 23:00pm    
Hi, I am dealing with the same issue right now.Can you please let me know any suggestions? Did you resolve this... Can you please help me with a solution.

1 solution

Try either Environment.NewLine or "\r\n".

I think that the office products are a bit more pedantic when it comes to line feeds and it reqires a carrage return also.
 
Share this answer
 
v2
Comments
Maciej Los 16-May-12 7:00am    
Good answer, my 5!
Prasad Avunoori 29-May-14 5:55am    
This didn't work for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900