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

Save Output To File

1
Hi,

I have quite a complex ASP page that builds an HTML table. I want to save this output in a format readable by Excel on the local machine automatically WITHOUT having to open it in Excel first.

At the moment my header is :

Response.ContentType="application/xls"
Response.AddHeader "Content-Disposition", " filename= report.xls"

Which opens in excel just fine but is there an easy way to save the file without having to Save it from Excel?

Thanks in advance!
Jul 22 '08 #1
1 2653
danp129
323 Expert 256MB
Hi,

I have quite a complex ASP page that builds an HTML table. I want to save this output in a format readable by Excel on the local machine automatically WITHOUT having to open it in Excel first.

At the moment my header is :

Response.ContentType="application/xls"
Response.AddHeader "Content-Disposition", " filename= report.xls"

Which opens in excel just fine but is there an easy way to save the file without having to Save it from Excel?

Thanks in advance!

With your current Content-Disposition, windows clients will check the registry to see if the user prefers to auto-open files of that type after it's downloaded.

You can change the option by opening a Windows Explorer window and going to Tools>Folder Options>File Types, find XLS and click advanced and check "Confirm open after download". This will make it prompt to open or save again until you click a box to always open on the save dialog.

Now if you want it to force a open/save dialog for every user regardless of that setting, you can force it to prompt by adding "attachment;" before the filename= like so:

Response.AddHeader "Content-Disposition", "attachment;filename=report.xls"
Jul 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Poster | last post by:
I have a script, its outputs are in HTML. It displays perferctly in a browser, however when I view source, it gives me the JS scripts, but I want to view the HTML output. Is there a way I can view...
9
by: Ivan Demkovitch | last post by:
Hi! I would like to know if I can save File on Server using server-side code? For example, I like to create thumbnail images and populate specific directory. Do I need specific permissions...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
0
by: crazyyellowguy | last post by:
hi, This is my first post in this forum and I just wanted to thank you for even taking a look at my post. The class that I am writing the C code for is my first computer class and my knowledge is...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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,...
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...

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.