|
i hav generated a table report in web page using asp code
nw i need to do is tht whn i click a button to export to excel thn the report in the web page shud automatically export to excel file and it shud save itself with filename having currentdate
as like "/forum/572004.xls".
can u able to send the code for this requirement ?
one thing it shud not prompt the user to give the file name to save in excel.
pls make it ASAP.
i hav used the code
Response.ContentType = "application/vnd.ms-excel"
but it is prompting the user to enter the file name to save file in excel.
|
|
|
Hi Satheesh,
Have u got any update on this?
I am also in the need of the exact same thing.
Also, do you know how to format the Excel Sheet while exporting?
Tx
Marx
|
|
|
I am in need of this same information - were you able to obtain any further info about it?
thanks
dj
|
|
|
hi,
This will prompt the user to save or open the file as currentdate.xls
<%
Dim strName
strName = Date()
strName = Replace(strName, "/index.html", "") ' "/index.html" Your local dateseparator?
strName = strName & "/forum/.xls"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=" & strName
%>
Autosave where? client, server (or in a database :) )? There are some different way to do that. On above the user can choose to save it anywhere from her/his own client, with the default filename (e.g currentdate.xls) already printed in the namefield.
If u choose to create the file on the server u can use below codesnap to force the browser to show the download file dialog rather than trying to open the file in the browser window.
<%
Dim oStr
Dim sFile
sFile = Request.QueryString("file")
Set oStr = server.CreateObject("ADODB.Stream")
oStr.Open
oStr.LoadFromFile Server.MapPath(sFile)
Response.ContentType = "xxx/xxx"
Response.AddHeader "content-disposition", "attachment; filename=" & sFile
Response.BinaryWrite oStr.ReadText
%>
|
|
|
Hi everybody,
Can anybody help me in getting this code. Iam able to display the excel sheet in the browser. but I want to export the data in a html to a excel sheet when a button is cliked.
Thanks in advance
|
|
|
hi sateesh,
can you help me in getting the code. My requirement is the same as your, when you click on button the data in html should be posted to excel sheet. It is not a problem if saveas dialogbox is appearing. I will be thankful, if you can send me the code
thanks
mythri
|
|
|