codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  need code to export html report to excel and autosave with current date as filenaem  satheesh at 10:02 on Friday, May 07, 2004
 

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.



  Re: need code to export html report to excel and autosave with current date as filenaem  marx at 21:45 on Thursday, May 20, 2004
 

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

  Re: need code to export html report to excel and autosave with current date as filenaem  djbrown at 14:58 on Wednesday, June 09, 2004
 

I am in need of this same information - were you able to obtain any further info about it?

thanks
dj

  Re: need code to export html report to excel and autosave with current date as filenaem  spookie at 08:41 on Monday, July 05, 2004
 

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
%>



  Re: need code to export html report to excel on a button click event  mythri at 07:26 on Saturday, July 24, 2004
 

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



  Re: need code to export html report to excel and autosave with current date as filenaem  mythri at 07:55 on Saturday, July 24, 2004
 

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







CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: ASP Email System Source Code
•  Learning VB(Looking for opinions)
•  How to open a .DOC file in MS-Word thru a link
•  Export database`s data into a CSV file in jspscript.....
•  Adding values to text field from popup - JavaScript
•  How to insert Javascript within Javascript ?
•  Event Close Browser botton
•  setting alphanumeric code
•  syntax error in insert statement .please help me solve it


Recent Articles
Simple Thumbnail Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)
Function to Return Alpha Characters Only
The OSI Reference Model - A Clear and Concise Illustration !


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2004