Discussion
I have the following code on a page wich exports the data on the screen to an excel spread sheet, but only if excel is installed on that machine. Is there any way of exporting to a CSV or plain text
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Response.Write(htmlbody)
>>> Edited by sykes111s on Tuesday 12th August 16:24
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Response.Write(htmlbody)
>>> Edited by sykes111s on Tuesday 12th August 16:24
Bonce said:
Response.ContentType = "text/plain"
Response.AddHeader "Content-Disposition", "filename=export.csv;"
A bit hazy from memory:
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attached; filename=export.csv;"
There's an RFC that covers it somewhere - one of the MIME ones I think.
I've had to do this in the past, basically used the file system object to create a new text file (.csv) and wrote each row from a db query to the file (comma seperated) and vbcrlf attached to each as a string. Not very elegent but does the job.
If you want go down that road let me know I'll see if I can dig up the code for you.
If you want go down that road let me know I'll see if I can dig up the code for you.
OK. We do this all the time.
Way to go is an ActiveX control that writes a file to the local file system and instantiates Excel to pick it up. You end up with absolute control over what is in the file and the ability to automate Excel to do what you want...
Down side is unless you are an MFC/ATL kind of person this gets damn complicated....and ActiveX controls are very sensitive to permissions/browsersettings bollocks on the client PC.
Way to go is an ActiveX control that writes a file to the local file system and instantiates Excel to pick it up. You end up with absolute control over what is in the file and the ability to automate Excel to do what you want...
Down side is unless you are an MFC/ATL kind of person this gets damn complicated....and ActiveX controls are very sensitive to permissions/browsersettings bollocks on the client PC.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff