Link to home
Start Free TrialLog in
Avatar of kari208
kari208

asked on

CfContent types for excel

I am having difficulty with CFContent opening into Excel. On my computer it works fine, on others Excel will open but no data is populated and/or it can't resolve the form parameters I'm sending to it. Does this have to do with setting up mime types? Is there a standard configuration I can set so this will work across all computers.

Here's the line of code I am using:

<CFCONTENT type="application/vnd.ms-excel">

Thanks!
Avatar of cheekycj
cheekycj
Flag of United States of America image

try one of these"
   application/vnd.ms-excel  
   application/x-msexcel  
   application/ms-excel
   application/msexcel
   application/x-excel
actually.. now re-reading the question... the issue might be the mime types setup for the browser.. which browser is it?

CJ
Avatar of kari208
kari208

ASKER

IE 5.5
ok try this:
<CFHEADER NAME="content-disposition" VALUE="attachment; filename=whatever.xls">
     <!--- Do all your queries.. form processing etc  --->
     <!--- Set the content type of the file. --->
     <CFCONTENT TYPE="text/tabdelimited">

<!--- output formatted data in a table --->
Avatar of kari208

ASKER

IE 5.5
Avatar of kari208

ASKER

That seemed to do the trick EXCEPT that now I'm prompted as to whether I want to save or open. Not a horrible thing, but any way I can get around that??

Thanks so much!
you have to add "text/tabdelimited" as a mime type that is opened by MS Excel..

CJ
Avatar of kari208

ASKER

That seemed to do the trick EXCEPT that now I'm prompted as to whether I want to save or open. Not a horrible thing, but any way I can get around that??

Thanks so much!
Avatar of kari208

ASKER

I'm sure I should know how to do that, but I don't...:)
Avatar of kari208

ASKER

I'm sure I should know how to do that, but I don't...:)
Avatar of kari208

ASKER

I'm sure I should know how to do that, but I don't...:)
Now This might work without changing any mime types:
<CFHEADER NAME="content-disposition" VALUE="attachment; filename=whatever.xls">
    <!--- Do all your queries.. form processing etc  --->
    <!--- Set the content type of the file. --->
    <CFCONTENT TYPE="application/vnd.ms-excel">

<!--- output formatted data in a table --->

To change/add mime type.
Launch Microsoft Explorer (not Internet Explorer).
From the View menu, choose Options or from the Tools menu, choose Folder Options.
Select the File Types tab.
Click "New"
Add extension "xlc" // you may have to change the extension since xls is taken.
select MS-Excel as the app to open it with.

Also make sure that in the above "File Types" tab.. for file type xls it has open in window selected (should be under Advanced button)

CJ
Please don't hit reload.. it posts the last comment again.. and sends me another email :-)

There is a link on the top of this page.. on the right.. "Reload Question"  Click that to check for updates.

CJ
Avatar of kari208

ASKER

Sorry about the reload...I noticed that a bit late. :)

This code got me down to one prompt versus two:
<CFHEADER NAME="content-disposition" VALUE="attachment; filename=whatever.xls">
   <!--- Do all your queries.. form processing etc  --->
   <!--- Set the content type of the file. --->
   <CFCONTENT TYPE="application/vnd.ms-excel">

To change the mime type, is there a way this can be done on the server so that I don't require all of my clients to have to change their mime types? If not, perhaps I'm just better off dealing with the prompt.
ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
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
Glad I could help.  Thanx for the "A"