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

using asp to generate excel = bad stuff

P: n/a
Hi, I am using the code below to create an excel document from data
that is returned from an sql query. The formatting of the excel
document is pretty and all is good unless I hit the back button and
run my query a second time, or a third time (I haven't made it past 3
times). Basically what happens is every time I do this, excel does
not close once I hit my back button. Does anyone have a solution to
this problem? Another problem is that when I run the query it just
opens excel within my browser, is there any way to make it ask if you
want to save or open the file? Thank You.

I basically throw this code at the top of the html doc:

<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
SPA
Hi

For your second problem, you could probably have a script code:

<SCRIPT Language="Javascript">
var resp;
resp = confirm("Do you want to open Excel file?");
if (resp)
window.open("Excelfile.xls", "_new", "width=300, height=300,
resizable=yes");
</SCRIPT>

This will execute the opening of your excel sheet in a separate window based
on your input.

HTH
SPA

"Jeremy" <ok********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Hi, I am using the code below to create an excel document from data
that is returned from an sql query. The formatting of the excel
document is pretty and all is good unless I hit the back button and
run my query a second time, or a third time (I haven't made it past 3
times). Basically what happens is every time I do this, excel does
not close once I hit my back button. Does anyone have a solution to
this problem? Another problem is that when I run the query it just
opens excel within my browser, is there any way to make it ask if you
want to save or open the file? Thank You.

I basically throw this code at the top of the html doc:

<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>

Jul 19 '05 #2

P: n/a
Thank You, this part worked, but I am still having the other problem.

-Jeremy

"SPA" <sh***********@usswi.com> wrote in message news:<uR*************@TK2MSFTNGP10.phx.gbl>...
Hi

For your second problem, you could probably have a script code:

<SCRIPT Language="Javascript">
var resp;
resp = confirm("Do you want to open Excel file?");
if (resp)
window.open("Excelfile.xls", "_new", "width=300, height=300,
resizable=yes");
</SCRIPT>

This will execute the opening of your excel sheet in a separate window based
on your input.

HTH
SPA

"Jeremy" <ok********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Hi, I am using the code below to create an excel document from data
that is returned from an sql query. The formatting of the excel
document is pretty and all is good unless I hit the back button and
run my query a second time, or a third time (I haven't made it past 3
times). Basically what happens is every time I do this, excel does
not close once I hit my back button. Does anyone have a solution to
this problem? Another problem is that when I run the query it just
opens excel within my browser, is there any way to make it ask if you
want to save or open the file? Thank You.

I basically throw this code at the top of the html doc:

<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.