473,805 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Example of streaming Excel to browser for download

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.
Nov 19 '05 #1
3 18934
Hi David,

A very efficient technique is to export an ASP.NET datagrid to the
browser... Excel can deal with it quite nicely:

http://www.c-sharpcorner.com/Code/20...ridToExcel.asp

Also, there's a free library that should help you output to Excel

http://www.asp.net/ControlGallery/Co...977&tabindex=2

If you need a heavy-duty $olution, you could go for this:

http://officewriter.softartisans.com...writer-37.aspx

Ken


"David Reynolds" <David Re******@discus sions.microsoft .com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
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.


Nov 19 '05 #2
Hi, I've had one of these "download to Excel" features for a while. I
appreciate the links, it would have saved me quite a bit of experimentation
If I had known about these links first.

Some users are capable of "downloadin g" and some users who were previously
able, now get a "Login" prompt asking for the Administrator password. After
that it does not display or download the page properly at all. I think their
problem is related to windows file associations but how does windows
associate a mime type with an application?

The work around is to use another computer where it works fine. It works
fine on my development computer (of course) and all of the computers here
but it consistently fails on certain computers. I was thinking that perhaps
multiple applications mapped to the same mime-type and the application that
was chosen by IE needed local administrator rights to run.

The page is actually an ASP page but I'm in the process of migrating the app
it from MSAccess to SQL Server and as far as I see the problem will continue
regardless of the server platform since the stream will remain unchanged.

Does anyone have any ideas or places I could look for ideas on resolving
this issue?

"Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message
news:O8******** *****@TK2MSFTNG P11.phx.gbl...
Hi David,

A very efficient technique is to export an ASP.NET datagrid to the
browser... Excel can deal with it quite nicely:

http://www.c-sharpcorner.com/Code/20...ridToExcel.asp

Also, there's a free library that should help you output to Excel

http://www.asp.net/ControlGallery/Co...977&tabindex=2

If you need a heavy-duty $olution, you could go for this:

http://officewriter.softartisans.com...writer-37.aspx

Ken


"David Reynolds" <David Re******@discus sions.microsoft .com> wrote in
message news:0E******** *************** ***********@mic rosoft.com...
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.

Nov 19 '05 #3
If you have the excel file data in a byte array you can stream it like so:

::CSV::
Response.ClearH eaders();
Response.Clear( );
Response.AddHea der( "Content-Disposition", "inline; filename=bob.cs v" );
Response.Conten tType = "text/csv";
Response.Binary Write( bytes );
Response.End();

::XLS::
Response.ClearH eaders();
Response.Clear( );
Response.AddHea der( "Content-Disposition", "inline; filename=bob.xl s" );
Response.Conten tType = "applicatio n/octet-stream";
Response.Binary Write( bytes );
Response.End();

HTH,

bill

"David Reynolds" <David Re******@discus sions.microsoft .com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
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.

Nov 19 '05 #4

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

Similar topics

1
4522
by: marty | last post by:
I have a webpage that displays data from a SQL database in table format. I found information on how to create a way to allow a user to download this information to Excel using 'Header()' in the PHP code. Header("Content-Type: application/vnd.ms-excel"); Header("Content-Disposition: attachment; filename=\"filename.xls\""); I setup a link on the display page that sends the variables needed for the SQL query to a different PHP page and...
3
12672
by: jim | last post by:
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
1
3513
by: Michael | last post by:
Hello, I'm looking for a way to allow a client who clicks on a link the ability to "adodb.stream" a multimedia file (mainly audio/wav) files, but the file they would be accessing is outside the wwwroot (for security / traceability). I don't want the "save as" box to open for streamable content. Basically I'm trying to mimic the exact action, as if they had clicked a www.mydomain.com/download.wav file, and allow the browser to open it...
4
1560
by: Krishna | last post by:
I am trying to stream html content as excel data from a webserver to an IE browser with the following ASP.NET code First Scenario: ----------------- An aspx page with a server side button control. When button is clicked, form is posted and the following code is executed on the server side. response.Buffer =true; response.Charset = "";
4
2502
by: Lewis Edward Moten III | last post by:
I have a file that users can download through a web page protected by forms authentication: Download.aspx?ID=45 and within that file ... FileInfo fileToDownload = new FileInfo(fileName);
3
1461
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 show the progress of the import. I do perform a Response.Flush() after each script tag. I've...
4
2228
by: Vishal | last post by:
Hello, I have a dataset with some content. I can convert this dataset in a csv format which is then stored in a stringwriter. Now I want this be open via excel, so I set the contenttype "application/vnd.ms-excel". To access this page the user requires to login, once the user is logged in he can access this file. Now when this file is opened in excel it shows me the login screen instead of the data. The user is already logged in, so why...
6
6771
by: Daniel | last post by:
Hi all, Can i open and edit the excel sheet on web page after downloading? After editing, i close the web page and the excel file auto upload to the server. Is it possible? I really struggling about the ability. If not, what advice can u provide? thank you in advance. ur help will be appreaciated.
6
2734
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios, every now and then the client would timeout and have to re-initiate the request... TIA!
0
9718
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10369
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3847
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.