473,418 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Asp streaming excel file - file name

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
3 12639
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
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
Jim
?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????????.????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? .????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ???????????>
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
1
by: CJM | last post by:
I have a page which allows the user to open one of several spreadsheets by streaming the XLS to the client. On my development site, everything appears to work fine. On the live site, it works...
6
by: CJM | last post by:
I have a page which allows the user to open one of several spreadsheets by streaming the XLS to the client. On my development site, everything appears to work fine. On the live site, it works...
0
by: Yelena Kaplun | last post by:
Hi, I'm trying to customize print settings while streaming HTML content into Excel. I'm using ASP.NET 1.1 and Excel 2003. While some printer settings like Margins are working correctly, I cannot...
2
by: Troy | last post by:
Hi all, I want to export the contents of a datatable out to a web client and I am wondering what the best performance and maintanence concious method of doing this is. Would it be possible to...
3
by: Casper Hornstrup | last post by:
I have an ASP.NET application that imports product descriptions from an Excel file. The Excel file is uploaded, then a background thread will start importing the product descriptions from the Excel...
3
by: David Reynolds | last post by:
Does anyone know how I could stream Excel to the browser for download without saving the file somewhere first. I wasn't sure how I would go about it.
0
by: MS News | last post by:
Hi All, I have a requirement to export asp.net page to Excel and Word. I need to set the default page setup for these documents to Landscape and Fit to page. I followed guidelines from the MS KB...
1
by: michael | last post by:
Hello all, I have a Linksys WVC54GC network camera that I am trying to integrate into a website and to enable browsers other than IE to use. Linksys, in their ever-short-sighted ways, decided...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.