?
Solved

Exporting to Excel - security warning

Posted on 2012-04-03
1
Medium Priority
?
670 Views
Last Modified: 2012-08-14
I am using the method below to export the contents of a cold fusion page to excel. When I try to open the file my browser gives me the following message (below also). Is there a way to avoid having this message displayed? Thanks.

Message
The file you are trying to open, 'filename.xls', is in a different format than specified by the file extension. Verify that the file is not corruupted and is from a trusted source before opening the file. Do you want to open the file now?

Method
<CFHEADER NAME="Content-Disposition" VALUE="attachment;filename=filename.xls">
<cfcontent type="application/vnd.ms-excel">
0
Comment
Question by:earwig75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 37801875
Is there a way to avoid having this message displayed?

No. It's a new ms office security feature called extension hardening. Whenever you open a file and the content doesn't match the file extension you'll get the warning.  In your case it's because the content is actually HTML, but the headers are saying it's an .xls file.

Individual users can disable the setting on their own computers.  But because it's a security feature, you can't do anything about it from the server.  The only way to avoid the warning is

See When you open a file in Excel 2007, you receive a warning that the file format differs from the format that the file name extension specifies

     1) generate a real excel file (like with cfspreadsheet)
      or
     2) ensure sure the content and file extension match, like generating *.csv file instead
0

Featured Post

How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question