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

Asp streaming excel file - file name

P: n/a
jim
I'm trying to stream a html page to the user as an excel
file.
I'm currently using
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "inline;
filename=download.xls "

The actual streaming and excel file are working fine but
in excel its not picking up the filename its actually
showing up as the url to the page that downloads this. I
would like to show up as download.xls or something similar
even if the path points to the web directory. Any help
would be greatly appreciated.
Thanks
Jim

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You might like this :)
It is token from some script you might change things but you'll get the
idea. Use Content-Disposition; attachment and not 'inline'...

Response.Buffer = False
Set the content type to the specific type that you are sending.
Response.ContentType = "application/vnd.ms-excel"

Dim strFilePath, lSize, lBlocks
Const CHUNK = 2048

objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
lSize = objStream.Size
Response.AddHeader "Content-Length", lSize
Response.AddHeader "Content-Disposition", "attachment; filename=" + strFile
lBlocks = 1
For lBlocks = lBlocks To lSize \ CHUNK
If Response.IsClientConnected = False Then Exit For
Response.BinaryWrite objStream.Read(CHUNK)
Next
lSize = lSize MOD CHUNK
If lSize > 0 And Response.IsClientConnected = True Then
Response.BinaryWrite objStream.Read(lSize)
End If
'
objStream.Close
'<!--object id="objStream" progid="ADODB.Stream" runat="server"></object-->
%>

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

"jim" <ji********@nospamforum-financial.com> wrote in message
news:0e****************************@phx.gbl...
I'm trying to stream a html page to the user as an excel
file.
I'm currently using
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "inline;
filename=download.xls "

The actual streaming and excel file are working fine but
in excel its not picking up the filename its actually
showing up as the url to the page that downloads this. I
would like to show up as download.xls or something similar
even if the path points to the web directory. Any help
would be greatly appreciated.
Thanks
Jim


Jul 19 '05 #2

P: n/a
Hmm, so then how will it get the filename of a file that doesn't exist. One
thing you could do is name your .asp file with a .xls extension and then
setup the mapping in IIS to have .xls file executed as asp files.

Ray at work

"Jim" <ji********@nospamforum-financial.com> wrote in message
news:07****************************@phx.gbl...
I'm actually creating the file on the fly. So the file
doesn't exist on the server. Sorry I didn't specifiy that.
Thanks for the quick response.
-----Original Message-----
In that case, just link to the .xls file itself.

Ray at work

"jim" <ji********@nospamforum-financial.com> wrote in

message
news:0e****************************@phx.gbl...
I'm trying to stream a html page to the user as an excel
file.
I'm currently using
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "inline;
filename=download.xls "

The actual streaming and excel file are working fine but
in excel its not picking up the filename its actually
showing up as the url to the page that downloads this. I
would like to show up as download.xls or something similar even if the path points to the web directory. Any help
would be greatly appreciated.
Thanks
Jim

.

Jul 19 '05 #3

P: n/a
Jim
?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????????.????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? .????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ???????????>
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.