Solved

Exporting to Excel - security warning

Posted on 2012-04-03
1
660 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
1 Comment
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now