I want to develop MS Excel download feature for some of my data, thus I created a VF page with following attributes on the apex:page tag.
contentType="application/vnd.ms-excel#somefile.xls" cache="true" applyHtmlTag="false" standardStylesheets="false" sidebar="false" showHeader="false"
With this I get the file downloaded but when I try to open it, the Excel application (I use 2013 version) shows a warning message before showing the data.
The file format and extension of 'somefile.xls' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?
I've used XML Spreadsheet markup for this and have avoided the use of Visualforce tags wherever I could, just to make sure the output is not HTML but native Spreadsheet markup. The file is not corrupted for sure since I can see the expected data as I open it after clicking "Yes" on the warning message.
Could anybody help me make this download without that warning message ?