xlsx 文件在下载时被解释为 zip 文件,为什么?

dre*_*mac 8 browser zip internet-explorer microsoft-excel

背景:出于某种原因,每当用户尝试使用 MSIE 从我们的 Intranet 打开 xslx (excel 2007) 文件时,文件下载对话框会将其解释为“zip”文件。

诚然,xslx 文件确实zip 文件,但我们不希望出现这种行为。请在 Excel 中打开。

题:

Firefox,OTOH,正常打开文件。有没有可能是我的 apache 配置出了问题?或者这是一个仅限客户端浏览器的问题?

小智 7

您确实可以在 Apache 的配置中解决此问题。添加以下几行(并确保启用了 mod_mime):

AddType application/vnd.ms-word.document.macroEnabled.12 .docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
Run Code Online (Sandbox Code Playgroud)

这将确保 Apache 向客户端发送适当的 MIME 类型,并且 IE 将理解这些文件是 Office 文档而不是 zip。


Dav*_*llo 6

我怀疑这是一个 apache 配置问题。Internet Explorer 有它自己的MIME 类型检测算法。您可以通过右键单击并选择“文件 -> 另存为”或仅使用 MS 2003 .doc 格式来规避此行为。