Link to home
Start Free TrialLog in
Avatar of TTWray
TTWray

asked on

Default "SaveAs" Value

I have generated a an HTML table that the displays in the browser as an Excel sheet using the following code :

Content-Type: application/vnd.ms-excel

However, when the selects File >> Save As from the browser menu, I want the default file "Save as Type" to be Microsoft Excel Workbook instead of "Web Page". How do I accomplish this?
ASKER CERTIFIED SOLUTION
Avatar of bruno
bruno
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TTWray
TTWray

ASKER

I am just using HTML. I have a LotusScript agent that is spitting out the HTML, but there is nothing special going on with the LotusScript.
SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
not familiar with LotusScript either, but that's what is making it display as Excel - not the HTML.  plain HTML can NOT do that.
make sure the filename is .xls

a simple way to do this is with mod_rewrite (if you are on apache):

RewriteEngine On
RewriteRule file.xls realfilename.html


then just reference file.xls with the script
This line

Content-Type: application/vnd.ms-excel

is telling the browser to display the file as Excel type

you cannot write client side script which will alter the users browser 'file' menu.
Avatar of TTWray

ASKER

I can't specify that the current page default to xls as the type instead of HTML if the user tries to save the page. I was hoping that if I could tell the browser to display it as Excel type, I could tell it to save it as Excel type also. Thanks for your help.
Hey TTwray,

Why the C?