473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Conten tType = "applicatio n/vnd.ms-excel"
Response.AddHea der "Content-Disposition", "inline;
filename=downlo ad.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 12658
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.Conten tType = "applicatio n/vnd.ms-excel"

Dim strFilePath, lSize, lBlocks
Const CHUNK = 2048

objStream.Open
objStream.Type = 1
objStream.LoadF romFile strFilePath
lSize = objStream.Size
Response.AddHea der "Content-Length", lSize
Response.AddHea der "Content-Disposition", "attachment ; filename=" + strFile
lBlocks = 1
For lBlocks = lBlocks To lSize \ CHUNK
If Response.IsClie ntConnected = False Then Exit For
Response.Binary Write objStream.Read( CHUNK)
Next
lSize = lSize MOD CHUNK
If lSize > 0 And Response.IsClie ntConnected = True Then
Response.Binary Write objStream.Read( lSize)
End If
'
objStream.Close
'<!--object id="objStream" progid="ADODB.S tream" runat="server"> </object-->
%>

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

"jim" <ji********@nos pamforum-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.Conten tType = "applicatio n/vnd.ms-excel"
Response.AddHea der "Content-Disposition", "inline;
filename=downlo ad.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********@nos pamforum-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********@nos pamforum-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.Conten tType = "applicatio n/vnd.ms-excel"
Response.AddHea der "Content-Disposition", "inline;
filename=downlo ad.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
35519
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy...
1
422
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 fine for the vast majority of users, but not for my colleague & I. When this page is called with the correct inputs, the standard...
6
3616
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 fine for the vast majority of users, but not for my colleague & I. When this page is called with the correct inputs, the standard...
0
2027
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 change the Page Orientation to Landscape: mso-page-orientation:landscape;. I tried to produce the Excel Page, save it as HTML, open in text editor...
2
3731
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 have the text file streamed out to the client directly? Meaning, I don't even want to write the text file to disk - just create it in memory and...
3
1448
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 file. When the Excel file is uploaded, the user's browser is redirected (using Response.Redirect) to a new page that will stream some javascript to...
3
18824
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
1176
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 article "How To Format an Excel Workbook While Streaming MIME Content"(http://support.microsoft.com/kb/271572/EN-US/) to be able to successfully set...
1
14740
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 to make this device only compatible with IE. It requires IE and ActiveX. However, you can access the video stream directly with the following...
0
7923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.