5
votes

I've got a vbscript which generates Excel files, in the old-style Excel XML Spreadsheet 2003 format. It contains the necessary processing instructions (i.e. the <?mso-application progid="Excel.Sheet"?> tag) and my users are able to open them in Office 2003 and Office 2007 (running on XP), by double-clicking the attachment.

We are now testing a desktop build of Windows 7 x64 with Office 2010 x64 and this no longer works. The files just open in IE and show the underlying XML. If the file is saved to the desktop, it still shows the Excel emblem on the icon, but will still open in IE.

Is this a 64-bit issue or an Excel 2010 issue? Is there a fix? I'm thinking a persistent handler might be missing or mis-registered in the Registry, but I don't know what to add instead...

1

1 Answers

0
votes

A few thoughts:

Perhaps you need to specify the Content Header tag as well? This PHP code creates and opens an XML file in Excel 2016 for me:

<?php
    header('Response.ContentType = "application/vnd.ms-excel"');
    header('Content-Disposition: attachement; filename="xlxml.xml"');
    echo '<root><name>sample_name</name></root>';
    exit();
?>

This VBS demonstration generated an Excel file which opened properly in Excel 2016 for me.

A couple other links with some related insight:

Generating Excel (XML Spreadsheet) & Excel header functions

Content-type for MS Office XML

XML Schema Guidelines

Content Disposition