【问题标题】:How to deliver an Excel spreadsheet in XML format to IE10 + Office 2010?如何将 XML 格式的 Excel 电子表格传送到 IE10 + Office 2010?
【发布时间】:2013-11-12 03:09:56
【问题描述】:

我正在尝试向用户提供一个以 XML 格式组成的 Excel 文档。内容是这样开始的:

<?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...

我将其作为.xls 文件提供,MIME 类型只是application/excelContent-Disposition: attachment。在 IE

现在,使用 IE10 和 Office 2010,行为完全不同,我无法让它工作。 Excel 抱怨格式与文件扩展名 (http://i.imgur.com/VOMBcnr.gif) 不同。无论我使用哪种可能的 Excel MIME 类型,都会发生这种情况。

如果我将扩展名更改为.xml,IE 会一直尝试在新选项卡中打开它,结果只是空白页。同样,无论我尝试什么 MIME 类型,也不管“附件”设置如何(应该在 IE 外部打开它),都会发生这种情况。

考虑到它以前可以正常工作,我在这里做错了什么?

【问题讨论】:

标签: excel mime-types internet-explorer-10 office-2010


【解决方案1】:

我一直在与同样的问题作斗争。 我通过将Content-Disposition 设置为attachment(就像你一样)和ContentType 设置为application/vnd.ms-excel 来解决它。 我用 Chrome、IE 和 Firefox 进行了测试。只有 Firefox,如果我选择“打开方式”,浏览器会添加 .xls 扩展名。否则文件被下载。 希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多