By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,841 Members | 840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,841 IT Pros & Developers. It's quick & easy.

Display CSV file in browser

P: n/a
Hello,

I created a csv file on the server. I want to display it
in the browser and user can download the file to local
machine. Then I will delete the file from the server.
Here is my code:
Fname = "myfile.csv"
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-
Disposition", "inline; filename=""" & Fname & """")
Response.WriteFile(Fname)

Response.Flush()
Response.Close()

System.IO.File.Delete(Fname)

When I open the file on the server, it displays fine. But
on the browser, all the commas remains and the whole
string goes to the first column. When I tried to save it
into a csv file to the local machine, all the string still
display in the first column.

I searched the this website. It seems lots of message are
about display csv file in browser. Does anybody encounter
the same problem as I do? What is the solution?

Please help!!!
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi

Try using <pre>Your csv data</pre>
http://msdn.microsoft.com/library/de...bjects/pre.asp
Or put it in a <textarea>

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
"Mei Qin" <xu***@inovant.com> wrote in message
news:d2****************************@phx.gbl...
Hello,

I created a csv file on the server. I want to display it
in the browser and user can download the file to local
machine. Then I will delete the file from the server.
Here is my code:
Fname = "myfile.csv"
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-
Disposition", "inline; filename=""" & Fname & """")
Response.WriteFile(Fname)

Response.Flush()
Response.Close()

System.IO.File.Delete(Fname)

When I open the file on the server, it displays fine. But
on the browser, all the commas remains and the whole
string goes to the first column. When I tried to save it
into a csv file to the local machine, all the string still
display in the first column.

I searched the this website. It seems lots of message are
about display csv file in browser. Does anybody encounter
the same problem as I do? What is the solution?

Please help!!!

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.