Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Re: Downloading Excel Files


Message #1 by "richard wang" <rwang08902@h...> on Tue, 15 Oct 2002 22:52:47
> Craig,
>          this is a client side thing, due to the setup of their PC's. I 
can 
> provide the settings, but you are likely to have to be bale to alter the 
> registry on each affected PC.
> 
> At 17:02 15/08/01 +0100, you wrote:
> >Hi,
> >
> >I've built an ASP page that takes data from a DB, and puts it into an 
Excel
> >file for the user to download to their PC.
> >
> >I do not want IE to open the file but rather them download the Excel 
File to
> >their PC.
> >
> >
> >The code below forces the page to produce the excel file, but when IE 
comes
> >up with the Download box, asking you if you wish to Save It, or Run it 
from
> >it's location, the filename of the ASP page is what it's refering to.
> >
> ><%
> >Response.ContentType="application/vnd.ms-excel
> >Response.AddHeader "Content-Disposition", "filename=" & strFileName
> >%>
> >
> >
> >
> >For example, it asks me if I want to Save it or Run "ProduceExcel.asp" 
when
> >I'd like it to show the filename. When I choose Save As the correct 
filename
> >appears in the Save As... dialog box.
> >
> >
> >So how do I change it from displaying the filename of the ASP page in 
the
> >first place?
> >
> >Not sure if this is clear, but any help will be appreciated!
> >
> >Regards,
> >Craig.
> 
Message #2 by "Drew, Ron" <RDrew@B...> on Wed, 16 Oct 2002 07:35:01 -0400
This is a good link to look at...
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/odeopg
/
html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]
Sent: Tuesday, October 15, 2002 6:53 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files

> Craig,
>          this is a client side thing, due to the setup of their PC's.
I
can
> provide the settings, but you are likely to have to be bale to alter
the
> registry on each affected PC.
>
> At 17:02 15/08/01 +0100, you wrote:
> >Hi,
> >
> >I've built an ASP page that takes data from a DB, and puts it into an

Excel
> >file for the user to download to their PC.
> >
> >I do not want IE to open the file but rather them download the Excel
File to
> >their PC.
> >
> >
> >The code below forces the page to produce the excel file, but when IE

comes
> >up with the Download box, asking you if you wish to Save It, or Run
it
from
> >it's location, the filename of the ASP page is what it's refering to.
> >
> ><%
> >Response.ContentType=3D"application/vnd.ms-excel
> >Response.AddHeader "Content-Disposition", "filename=3D" & strFileName
> >%>
> >
> >
> >
> >For example, it asks me if I want to Save it or Run
"ProduceExcel.asp"
when
> >I'd like it to show the filename. When I choose Save As the correct
filename
> >appears in the Save As... dialog box.
> >
> >
> >So how do I change it from displaying the filename of the ASP page in

the
> >first place?
> >
> >Not sure if this is clear, but any help will be appreciated!
> >
> >Regards,
> >Craig.
>

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #3 by "richard wang" <rwang08902@h...> on Wed, 16 Oct 2002 15:49:41
Hi Ron,

Thanks for the reply, but the link is not working! Can you point me to the 
right one. Thanks.


richard

> This is a good link to look at...
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/odeopg
/
html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]
Sent: Tuesday, October 15, 2002 6:53 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files

> Craig,
>          this is a client side thing, due to the setup of their PC's.
I
can
> provide the settings, but you are likely to have to be bale to alter
the
> registry on each affected PC.
>
> At 17:02 15/08/01 +0100, you wrote:
> >Hi,
> >
> >I've built an ASP page that takes data from a DB, and puts it into an

Excel
> >file for the user to download to their PC.
> >
> >I do not want IE to open the file but rather them download the Excel
File to
> >their PC.
> >
> >
> >The code below forces the page to produce the excel file, but when IE

comes
> >up with the Download box, asking you if you wish to Save It, or Run
it
from
> >it's location, the filename of the ASP page is what it's refering to.
> >
> ><%
> >Response.ContentType=3D"application/vnd.ms-excel
> >Response.AddHeader "Content-Disposition", "filename=3D" & strFileName
> >%>
> >
> >
> >
> >For example, it asks me if I want to Save it or Run
"ProduceExcel.asp"
when
> >I'd like it to show the filename. When I choose Save As the correct
filename
> >appears in the Save As... dialog box.
> >
> >
> >So how do I change it from displaying the filename of the ASP page in

the
> >first place?
> >
> >Not sure if this is clear, but any help will be appreciated!
> >
> >Regards,
> >Craig.
>

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #4 by "Drew, Ron" <RDrew@B...> on Wed, 16 Oct 2002 12:12:23 -0400
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/odeo
p
g=3D/html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]
Sent: Wednesday, October 16, 2002 11:50 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files


Hi Ron,

Thanks for the reply, but the link is not working! Can you point me to
the
right one. Thanks.


richard

> This is a good link to look at...
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/odeo
p
g=3D
/
html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]=3D20
Sent: Tuesday, October 15, 2002 6:53 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files

> Craig,
>          this is a client side thing, due to the setup of their PC's.
I=3D20
can=3D20
> provide the settings, but you are likely to have to be bale to alter
the=3D20
> registry on each affected PC.
>=3D20
> At 17:02 15/08/01 +0100, you wrote:
> >Hi,
> >
> >I've built an ASP page that takes data from a DB, and puts it into an

Excel
> >file for the user to download to their PC.
> >
> >I do not want IE to open the file but rather them download the
> >Excel=3D20
File to
> >their PC.
> >
> >
> >The code below forces the page to produce the excel file, but when IE

comes
> >up with the Download box, asking you if you wish to Save It, or Run
it=3D20
from
> >it's location, the filename of the ASP page is what it's refering to.
> >
> ><%
> >Response.ContentType=3D3D"application/vnd.ms-excel
> >Response.AddHeader "Content-Disposition", "filename=3D3D" & 
strFileName

> >%>
> >
> >
> >
> >For example, it asks me if I want to Save it or Run
"ProduceExcel.asp"=3D20
when
> >I'd like it to show the filename. When I choose Save As the
> >correct=3D20
filename
> >appears in the Save As... dialog box.
> >
> >
> >So how do I change it from displaying the filename of the ASP page in

the
> >first place?
> >
> >Not sure if this is clear, but any help will be appreciated!
> >
> >Regards,
> >Craig.
>=3D20

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or=3D20 to
unsubscribe send a blank email to 

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #5 by "Drew, Ron" <RDrew@B...> on Wed, 16 Oct 2002 12:12:52 -0400
Try this...
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/odeo
p
g=3D/html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]
Sent: Wednesday, October 16, 2002 11:50 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files


Hi Ron,

Thanks for the reply, but the link is not working! Can you point me to
the
right one. Thanks.


richard

> This is a good link to look at...
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/odeo
p
g=3D
/
html/deovrworkingwithmicrosoftexcelobjects.asp

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]=3D20
Sent: Tuesday, October 15, 2002 6:53 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files

> Craig,
>          this is a client side thing, due to the setup of their PC's.
I=3D20
can=3D20
> provide the settings, but you are likely to have to be bale to alter
the=3D20
> registry on each affected PC.
>=3D20
> At 17:02 15/08/01 +0100, you wrote:
> >Hi,
> >
> >I've built an ASP page that takes data from a DB, and puts it into an

Excel
> >file for the user to download to their PC.
> >
> >I do not want IE to open the file but rather them download the
> >Excel=3D20
File to
> >their PC.
> >
> >
> >The code below forces the page to produce the excel file, but when IE

comes
> >up with the Download box, asking you if you wish to Save It, or Run
it=3D20
from
> >it's location, the filename of the ASP page is what it's refering to.
> >
> ><%
> >Response.ContentType=3D3D"application/vnd.ms-excel
> >Response.AddHeader "Content-Disposition", "filename=3D3D" & 
strFileName

> >%>
> >
> >
> >
> >For example, it asks me if I want to Save it or Run
"ProduceExcel.asp"=3D20
when
> >I'd like it to show the filename. When I choose Save As the
> >correct=3D20
filename
> >appears in the Save As... dialog box.
> >
> >
> >So how do I change it from displaying the filename of the ASP page in

the
> >first place?
> >
> >Not sure if this is clear, but any help will be appreciated!
> >
> >Regards,
> >Craig.
>=3D20

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or=3D20 to
unsubscribe send a blank email to 

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #6 by "Imar Spaanjaars" <Imar@S...> on Wed, 16 Oct 2002 18:31:17 +0200 (CEST)
I think the URL gets messed up because of mail settings:

Remove the 3D and the second = from the complete URL.

Maybe this will work:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeopg/html/deovrworkingwithmicrosoftexcelobjects.asp
Cheers,

Imar


> Try this...
> http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/odeop
> g=/html/deovrworkingwithmicrosoftexcelobjects.asp
>
> -----Original Message-----
> From: richard wang [mailto:rwang08902@h...]
> Sent: Wednesday, October 16, 2002 11:50 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Downloading Excel Files
>
>


Message #7 by "richard wang" <rwang08902@h...> on Wed, 16 Oct 2002 18:34:33
Thanks. This time the link does work, but it is not related to my 
question. I do not need know how to program Excel object, instead I want 
to see the right file name in the "File Download" dialog box. Let me give 
you an example: say I have a ASP page called download.asp with a link to 
download a file named myfile.xls. When I force the "File Download" dialog 
box up, I see "download.asp" as the downloading filename, instead 
of "myfile.xls". One thing I want to point out is that I did set the 
filename attribute in the content-disposition(HTTP header) to myfile.xls. 

I see many complains about this in various newsgroup, but none of them 
give a solution. Any suggestion will be greatly appreciated.


Richard

> I think the URL gets messed up because of mail settings:

Remove the 3D and the second = from the complete URL.

Maybe this will work:

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/odeopg/html/deovrworkingwithmicrosoftexcelobjects.asp
Cheers,

Imar


> Try this...
> http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/odeop
> g=/html/deovrworkingwithmicrosoftexcelobjects.asp
>
> -----Original Message-----
> From: richard wang [mailto:rwang08902@h...]
> Sent: Wednesday, October 16, 2002 11:50 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Downloading Excel Files
>
>


Message #8 by "Drew, Ron" <RDrew@B...> on Wed, 16 Oct 2002 14:25:01 -0400
How do you get rid of the 3D that automatically gets embedded by the =3D

-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Wednesday, October 16, 2002 12:31 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files


I think the URL gets messed up because of mail settings:

Remove the 3D and the second =3D from the complete URL.

Maybe this will work:

http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/odeopg
/
html/deovrworkingwithmicrosoftexcelobjects.asp
Cheers,

Imar


> Try this...
> 
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/ode
> op
> g=3D/html/deovrworkingwithmicrosoftexcelobjects.asp
>
> -----Original Message-----
> From: richard wang [mailto:rwang08902@h...]
> Sent: Wednesday, October 16, 2002 11:50 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Downloading Excel Files
>
>




---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #9 by "Drew, Ron" <RDrew@B...> on Wed, 16 Oct 2002 14:44:39 -0400
Response.AddHeader "content-disposition"," filename=3Dmyfile.xls"

Not sure if this will help you

-----Original Message-----
From: richard wang [mailto:rwang08902@h...]
Sent: Wednesday, October 16, 2002 2:35 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Downloading Excel Files


Thanks. This time the link does work, but it is not related to my
question. I do not need know how to program Excel object, instead I want

to see the right file name in the "File Download" dialog box. Let me
give
you an example: say I have a ASP page called download.asp with a link to

download a file named myfile.xls. When I force the "File Download"
dialog
box up, I see "download.asp" as the downloading filename, instead
of "myfile.xls". One thing I want to point out is that I did set the
filename attribute in the content-disposition(HTTP header) to
myfile.xls.

I see many complains about this in various newsgroup, but none of them
give a solution. Any suggestion will be greatly appreciated.


Richard

> I think the URL gets messed up because of mail settings:

Remove the 3D and the second =3D from the complete URL.

Maybe this will work:

http://msdn.microsoft.com/library/default.asp?url=3D/library/en-
us/odeopg/html/deovrworkingwithmicrosoftexcelobjects.asp
Cheers,

Imar


> Try this...
> 
http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/ode
> op
> g=3D/html/deovrworkingwithmicrosoftexcelobjects.asp
>
> -----Original Message-----
> From: richard wang [mailto:rwang08902@h...]
> Sent: Wednesday, October 16, 2002 11:50 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Downloading Excel Files
>
>



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #10 by Imar Spaanjaars <Imar@S...> on Wed, 16 Oct 2002 20:47:15 +0200
Hi Richard,

What's the code you are using? AFAIK, the code below will show the filename 
on most browsers, but in some cases, indeed download.asp will be shown. I 
haven't seen a work around for that one yet, unfortunately.....

<%
     sFullFileName = "d:\Test\Test.jpg"
     sFileName = "Test.jpg"
     Response.Contenttype="application/x-unknown"
     Response.Addheader "Content-Disposition", "attachment; filename=" & 
chr(34) & sFileName & chr(34)
     Response.BinaryWrite GetBinaryFile(sFullFileName)

Public Function GetBinaryFile(sFileSpec)
     Const adTypeBinary = 1
     Dim objStream
     Set objStream = Server.Createobject("ADODB.Stream")
     objStream.Open
     objStream.Type = adTypeBinary
     objStream.LoadFromFile sFileSpec
     GetBinaryFile = objStream.read
     Set objStream = Nothing
End Function

%>

At 06:34 PM 10/16/2002 +0000, you wrote:
>Thanks. This time the link does work, but it is not related to my
>question. I do not need know how to program Excel object, instead I want
>to see the right file name in the "File Download" dialog box. Let me give
>you an example: say I have a ASP page called download.asp with a link to
>download a file named myfile.xls. When I force the "File Download" dialog
>box up, I see "download.asp" as the downloading filename, instead
>of "myfile.xls". One thing I want to point out is that I did set the
>filename attribute in the content-disposition(HTTP header) to myfile.xls.
>
>I see many complains about this in various newsgroup, but none of them
>give a solution. Any suggestion will be greatly appreciated.
>
>
>Richard


Message #11 by "richard wang" <rwang08902@h...> on Wed, 16 Oct 2002 20:47:29
Hi Imar,

Thanks for the definite answer for this matter.

I wrote something similar to yours using ADO stream object and 
manipulating HTTP headers, having the file download working ok except the 
name of the file is wrong. If it is a problem related to individual's 
browser setting, then there is nothing we can do at this point.

But I just find something contradicting  with this: when I try to download 
something from wrox site or from xmlandasp.net, they both give me the 
right name in the file download dialog box using the same IE as I use for 
my code testing. Still this does not solve my problem, just seems ruling 
out browser concern to me.

Please let me know if you understand it differently. Thanks so much.


richard    

Message #12 by Imar Spaanjaars <Imar@S...> on Wed, 16 Oct 2002 21:48:43 +0200
First of all: I am not sure this is a definite answer. I just based this on 
my experience, but I am not 100% sure it's true.

Secondly, can't it be that when you download something from Wrox, you 
actually download a file like this:

http://web.wrox.com/download/code/beginning/7361.zip

instead of from an ASP page that reads in the file and passes it to the 
client? I think the "problem" is related to the fact that code defines the 
header, and the webserver.

Imar


At 08:47 PM 10/16/2002 +0000, you wrote:
>Hi Imar,
>
>Thanks for the definite answer for this matter.
>
>I wrote something similar to yours using ADO stream object and
>manipulating HTTP headers, having the file download working ok except the
>name of the file is wrong. If it is a problem related to individual's
>browser setting, then there is nothing we can do at this point.
>
>But I just find something contradicting  with this: when I try to download
>something from wrox site or from xmlandasp.net, they both give me the
>right name in the file download dialog box using the same IE as I use for
>my code testing. Still this does not solve my problem, just seems ruling
>out browser concern to me.
>
>Please let me know if you understand it differently. Thanks so much.
>
>
>richard



  Return to Index