Features and Bugs
In the world of the web, or any software for that matter, there’s often a fine line between a ‘feature’ and a bug. While some people find that they can’t do exactly what they want, there’s usually a reason behind it, therefore it’s a feature (usually security) and not a bug. Last week I ran into a feature that had been working for a long time, and now no longer doesn’t.
In most projects that we work on, there is inevitably some request to export data in a pretty and useful format. Traditionally we use some cfheader and cfcontent tags to export tables to Excel. Sometimes we can export to CSV (comma delimited file) but often that doesn’t work for our clients and it’s easiest to just shove it out into the excel format. It’s also easier to write, we just need one table view template that can be wrapped with either the display template or the excel output template. Recently we’ve run across a few minor issues, the most annoying of which is the error popping up in Excel 2007. The message is as follows:
The file you are trying to open, ‘downloadreport.xls’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
According to all the research I’ve done, this is a Microsoft feature (not a DDA bug). Apparently in the 2007 version of Office (and perhaps others) a new security feature has been added called Extension Hardening that rejects any web generated files unless it’s got the proper header format (proper mso file). Of course you can still open the file by clicking yes to the above dialog, but that of course scares most people, as it probably should. So the race is on to find the proper format (Microsoft says to use the open xml file format) and add that in as an option for future use. If I ever find the proper formatting, I’ll let everyone know.