2

I'm trying to deliver an Excel document to the user, which is composed in XML format. The content begins like this:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
  <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
etc...

I was delivering this as an .xls file, MIME type simply application/excel and Content-Disposition: attachment. In IE < 10 and Office < 2010, it would open directly in MS Excel, no problems.

Now, with IE10 and Office 2010, behaviour is completely different and I can't get it to work. Excel is complaining that the format is different to the file extension (https://i.stack.imgur.com/GsDy8.gif). This occurs no matter which of the possible Excel MIME types I use.

If I change the extension to .xml, IE keeps trying to open it in a new tab, resulting in nothing but a blank page. Again, this occurs no matter what MIME type I try, and regardless of the "attachment" setting (which is supposed to open it outside IE).

What am I doing wrong here, considering it used to work fine before?

ingredient_15939
  • 3,022
  • 7
  • 35
  • 55

1 Answers1

2

I have been fighting with the same problem. I solve it by setting the Content-Disposition to attachment (like you do) and the ContentType to application/vnd.ms-excel. I tested with Chrome, IE and Firefox. Only by Firefox, the browser add the .xls extension if I choose "Open with". Otherwise the file was downloaded. I hope this helps you.

Fredo
  • 320
  • 3
  • 15