473,387 Members | 1,365 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,387 software developers and data experts.

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 18744
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******@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.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 "downloading" 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*************@TK2MSFTNGP11.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******@discussions.microsoft.com> wrote in
message news:0E**********************************@microsof t.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.ClearHeaders();
Response.Clear();
Response.AddHeader( "Content-Disposition", "inline; filename=bob.csv" );
Response.ContentType = "text/csv";
Response.BinaryWrite( bytes );
Response.End();

::XLS::
Response.ClearHeaders();
Response.Clear();
Response.AddHeader( "Content-Disposition", "inline; filename=bob.xls" );
Response.ContentType = "application/octet-stream";
Response.BinaryWrite( bytes );
Response.End();

HTH,

bill

"David Reynolds" <David Re******@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.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
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...
3
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;...
1
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...
4
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...
4
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
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...
4
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...
6
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...
6
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,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
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,...

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.