save .csv with newline character

Posted by Sansircar under ASP.NET on 11/17/2008 | Views : 4412 | Status : [Member] | Replies : 2
i'm creating a .csv file on the fly, thus am enclosing all the data within double quotes.
how to put in a newline character is the problem. for eg:-
i tried the following -

"header1","header2","header3"\n"data1","data2","data3"\n"data11","data22","data33"

and

"header1","header2","header3 \n"\r\n "data1","data2","data3 \n"\r\n "data11","data22","data33"

so that the output looks like

header1 header2 header3
data1 data2 data3
data11 data22 data33

thanks a lot for your help




Responses

Posted by: Raja on: 11/18/2008 [Member] Starter

Up
0
Down
You can use Environment.NewLine instead of "\n".

Like :

"header1" + Environment.NewLine + "header2"

The output will be

header1
header2

Thanks.

Regards,
Raja, USA

Sansircar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandhseke on: 3/9/2009 [Member] Starter

Up
0
Down
I need multiple line of text in the database to be displayed in one single column in Excell sheet (when i am trying to extract data from database to excell sheet)..please help me in this.
Thanks



Sansircar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response