转: http://blog.minidx.com/2008/01/24/436.html
导致原因:
从IIS或者Tomcat之类的Web服务器通过二进制流下载文件时(比如通过设置Header为Content-disposition:inline),如果被下载的文件是Office2007的dotx,docx,pot等后缀的时候,下载对话框中的图标会变成ZIP的,相应的文件名也会成为zip为扩展后缀的文件。其实出现这样的情况,是由于IE中对下载文件类型的判断,假如找不到相应后缀的MIME的话,会自动根据数据流来判断文件的类型,而微软对Office2007的格式做了和以前完全不同的处理。
以前的Office文档是100%的二进制格式。第三方的工具操作起来非常不方便,而 Office2007从整体上都是基于XML格式的,这里并不是说Office2007文档可以保存成XML格式。而是Office2007默认的文档格式就是XML的(Word的docx、Excel的xlsx等)。也许有人会感到奇怪,用文本编辑器打开docx后,显示的仍然是二进制格式,并不是什么 XML。其实docx并不是普通的XML格式,当然,也不只是一个XML文件,docx本质上是一个zip文件,里面有一系列的xml、目录和其他的文件。如果我们将docx改成zip。就可以用winzip等软件将其解开。
解决方案:
在Server端添加MIME映射就可以了。如Tomcat , 修改/%tomcat_home%/conf/web.xml
<mime-mapping>
<extension>docx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xlsx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
</mime-mapping>
<mime-mapping>
<extension>pptx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime-type>
</mime-mapping>
附录:
下面收集了大部分文件的扩展名和相应的MIME对应,有需要的可以在列表中找到并添加。
.asx,video/x-ms-asf
.xml,text/xml
.tsv,text/tab-separated-values
.ra,audio/x-pn-realaudio
.sv4crc,application/x-sv4crc
.spc,application/x-pkcs7-certificates
.pmc,application/x-perfmon
.lit,application/x-ms-reader
.crd,application/x-mscardfile
.isp,application/x-internet-signup
.wmlsc,application/vnd.wap.wmlscriptc
.vst,application/vnd.visio
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.ttf,application/octet-stream
.pfm,application/octet-stream
.csv,application/octet-stream
.aaf,application/octet-stream
.one,application/onenote
.hta,application/hta
.atom,application/atom+xml
.323,text/h323
.mhtml,message/rfc822
.midi,audio/mid
.p7r,application/x-pkcs7-certreqresp
.mny,application/x-msmoney
.clp,application/x-msclip
.vsd,application/vnd.visio
.lpk,application/octet-stream
.bin,application/octet-stream
.onetoc,application/onenote
.x,application/directx
.wvx,video/x-ms-wvx
.vcf,text/x-vcard
.htc,text/x-component
.htt,text/webviewhtml
.h,text/plain
.mht,message/rfc822
.mid,audio/mid
.p7b,application/x-pkcs7-certificates
.gz,application/x-gzip
.dvi,application/x-dvi
.cpio,application/x-cpio
.vdx,application/vnd.ms-visio.viewer
.sldm,application/vnd.ms-powerpoint.slide.macroEnabled.12
.xlm,application/vnd.ms-excel
.fdf,application/vnd.fdf
.setreg,application/set-registration-initiation
.eps,application/postscript
.p7s,application/pkcs7-signature
.toc,application/octet-stream
.mdp,application/octet-stream
.ics,application/octet-stream
.chm,application/octet-stream
.asi,application/octet-stream
.afm,application/octet-stream
.evy,application/envoy
.wmp,video/x-ms-wmp
.qt,video/quicktime
.mpv2,video/mpeg
.xslt,text/xml
.etx,text/x-setext
.cod,image/cis-cod
.snd,audio/basic
.au,audio/basic
.man,application/x-troff-man
.qtl,application/x-quicktimeplayer
.pmw,application/x-perfmon
.class,application/x-java-applet
.iii,application/x-iphone
.csh,application/x-csh
.z,application/x-compress
.vtx,application/vnd.visio
.vsw,application/vnd.visio
.wps,application/vnd.ms-works
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ps,application/postscript
.p7c,application/pkcs7-mime
.thn,application/octet-stream
.mso,application/octet-stream
.dot,application/msword
.doc,application/msword
.sgml,text/sgml
.nws,message/rfc822
.pbm,image/x-portable-bitmap
.ief,image/ief
.wav,audio/wav
.texi,application/x-texinfo
.mvb,application/x-msmediaview
.hdf,application/x-hdf
.vsx,application/vnd.visio
.dotm,application/vnd.ms-word.template.macroEnabled.12
.docm,application/vnd.ms-word.document.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.psm,application/octet-stream
.java,application/octet-stream
.eot,application/octet-stream
.jar,application/java-archive
.mpeg,video/mpeg
.xsf,text/xml
.map,text/plain
.uls,text/iuls
.rf,image/vnd.rn-realflash
.m3u,audio/x-mpegurl
.wma,audio/x-ms-wma
.aifc,audio/aiff
.mdb,application/x-msaccess
.mvc,application/x-miva-compiled
.stl,application/vnd.ms-pki.stl
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.setpay,application/set-payment-initiation
.prm,application/octet-stream
.mix,application/octet-stream
.lzh,application/octet-stream
.hhk,application/octet-stream
.onepkg,application/onenote
.xaf,x-world/x-vrml
.flr,x-world/x-vrml
.IVF,video/x-ivf
.cnf,text/plain
.asm,text/plain
.tiff,image/tiff
.wax,audio/x-ms-wax
.ms,application/x-troff-ms
.tcl,application/x-tcl
.shar,application/x-shar
.sh,application/x-sh
.nc,application/x-netcdf
.hlp,application/winhlp
.oda,application/oda
.pfb,application/octet-stream
.fla,application/octet-stream
.wm,video/x-ms-wm
.rgb,image/x-rgb
.ppm,image/x-portable-pixmap
.ram,audio/x-pn-realaudio
.sit,application/x-stuffit
.dir,application/x-director
.mpp,application/vnd.ms-project
.xla,application/vnd.ms-excel
.ssm,application/streamingmedia
.axs,application/olescript
.ods,application/oleobject
.psp,application/octet-stream
.jpb,application/octet-stream
.wrz,x-world/x-vrml
.m1v,video/mpeg
.mno,text/xml
.cmx,image/x-cmx
.jpeg,image/jpeg
.dib,image/bmp
.rmi,audio/mid
.aiff,audio/aiff
.wmd,application/x-ms-wmd
.wri,application/x-mswrite
.pub,application/x-mspublisher
.ins,application/x-internet-signup
.wks,application/vnd.ms-works
.xls,application/vnd.ms-excel
.ai,application/postscript
.crl,application/pkix-crl
.qxd,application/octet-stream
.dwp,application/octet-stream
.xof,x-world/x-vrml
.wmv,video/x-ms-wmv
.nsc,video/x-ms-asf
.mpa,video/mpeg
.pnm,image/x-portable-anymap
.rpm,audio/x-pn-realaudio-plugin
.aif,audio/x-aiff
.me,application/x-troff-me
.pml,application/x-perfmon
.trm,application/x-msterminal
.m13,application/x-msmediaview
.js,application/x-javascript
.dxr,application/x-director
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlt,application/vnd.ms-excel
.xlc,application/vnd.ms-excel
.p10,application/pkcs10
.smi,application/octet-stream
.sea,application/octet-stream
.hqx,application/mac-binhex40
.spl,application/futuresplash
.movie,video/x-sgi-movie
.lsf,video/x-la-asf
.txt,text/plain
.jfif,image/pjpeg
.jpe,image/jpeg
.zip,application/x-zip-compressed
.wmf,application/x-msmetafile
.m14,application/x-msmediaview
.latex,application/x-latex
.wcm,application/vnd.ms-works
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.hhp,application/octet-stream
.aca,application/octet-stream
.accdb,application/msaccess
.jcz,application/liquidmotion
.wrl,x-world/x-vrml
.wmx,video/x-ms-wmx
.asr,video/x-ms-asf
.lsx,video/x-la-asf
.xsl,text/xml
.html,text/html
.tif,image/tiff
.der,application/x-x509-ca-cert
.pfx,application/x-pkcs12
.p12,application/x-pkcs12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.cur,application/octet-stream
.accdt,application/msaccess
.hdml,text/x-hdml
.htm,text/html
.xbm,image/x-xbitmap
.jpg,image/jpeg
.texinfo,application/x-texinfo
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.xlw,application/vnd.ms-excel
.rm,application/vnd.rn-realmedia
.pdf,application/pdf
.rar,application/octet-stream
.psd,application/octet-stream
.inf,application/octet-stream
.emz,application/octet-stream
.dsp,application/octet-stream
.onea,application/onenote
.jck,application/liquidmotion
.mpe,video/mpeg
.mp2,video/mpeg
.sct,text/scriptlet
.ras,image/x-cmu-raster
.swf,application/x-shockwave-flash
.wmz,application/x-ms-wmz
.gtar,application/x-gtar
.dcr,application/x-director
.sldx,application/vnd.openxmlformats-officedocument.presentationml.slide
.pps,application/vnd.ms-pps
.p7m,application/pkcs7-mime
.xsn,application/octet-stream
.ocx,application/octet-stream
.accde,application/msaccess
.mov,video/quicktime
.wmls,text/vnd.wap.wmlscript
.cpp,text/plain
.c,text/plain
.bas,text/plain
.css,text/css
.art,image/x-jg
.mp3,audio/mpeg
.t,application/x-troff
.roff,application/x-troff
.tar,application/x-tar
.hhc,application/x-oleobject
.scd,application/x-msschedule
.pko,application/vnd.ms-pki.pko
.sst,application/vnd.ms-pki.certstore
.ppt,application/vnd.ms-powerpoint
.xtp,application/octet-stream
.u32,application/octet-stream
.pcx,application/octet-stream
.msi,application/octet-stream
.exe,application/octet-stream
.asd,application/octet-stream
.onetoc2,application/onenote
.fif,application/fractals
.mpg,video/mpeg
.vml,text/xml
.xdr,text/plain
.vcs,text/plain
.hxt,text/html
.eml,message/rfc822
.xpm,image/x-xpixmap
.ico,image/x-icon
.gif,image/gif
.dwf,drawing/x-dwf
.src,application/x-wais-source
.tr,application/x-troff
.pmr,application/x-perfmon
.pma,application/x-perfmon
.dll,application/x-msdownload
.bcpio,application/x-bcpio
.wmlc,application/vnd.wap.wmlc
.wdb,application/vnd.ms-works
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.pot,application/vnd.ms-powerpoint
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.rtf,application/rtf
.prf,application/pics-rules
.snp,application/octet-stream
.cab,application/octet-stream
.avi,video/x-msvideo
.asf,video/x-ms-asf
.dtd,text/xml
.wml,text/vnd.wap.wml
.vbs,text/vbscript
.rtx,text/richtext
.dlm,text/dlm
.xwd,image/x-xwindowdump
.pgm,image/x-portable-graymap
.bmp,image/bmp
.crt,application/x-x509-ca-cert
.ustar,application/x-ustar
.tex,application/x-tex
.sv4cpio,application/x-sv4cpio
.tgz,application/x-compressed
.cdf,application/x-cdf
.vss,application/vnd.visio
.cat,application/vnd.ms-pki.seccat
.thmx,application/vnd.ms-officetheme
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.prx,application/octet-stream
.pcz,application/octet-stream
.onetmp,application/onenote
.acx,application/internet-property-stream
.wsdl,text/xml
.disco,text/xml
.xsd,text/xml
.wbmp,image/vnd.wap.wbmp
.png,image/png
.pnz,image/png
.smd,audio/x-smd
.smz,audio/x-smd
.smx,audio/x-smd
.mmf,application/x-smaf
分享到:
相关推荐
- 选中文件时,移动到屏幕可视区域(解决上下左右选中文件滚动条不一致问题) ###ver2.51 `2014/6/22` ---- ####fix bug:(bug解决和程序优化) - 登陆多次密码输入错误验证码bug解决 - 修复漏洞:创建副本加入...
noform.zip 没有文档类的MDI怎样让MDI程序不需要文档的支持(33KB)<END><br>98,ROTFONT.zip 用于在窗口中显示任意角度文字的控件(5KB)<END><br>99,TRAYICON.zip 用于在WIN95的状态栏中显示程序的运行状态(32...
独立打包,保证可解压,内含大量源码,网上搜集...在MFC应用程序中浏览PDF、Word文档文件 vcdialog 自绘对话框。 vc编程:自动停靠窗体,吸附窗体 OnMoving事件处理。 vc基于HTTP协议断点续传和多线程下载源代码 VC...
3:可以在不下载ZIP.RAR.ISO文件的情况下查看文件里面的目录文件. 4:支持多语言. 5:操作综合其它软件. 6:自定义快捷键. 7:在IE工具栏上加按钮,可以直接拖动连接到按钮上下载. 8:注册采用激活方式. 9:采用Messenger的...
23,listtips.ZIP listbox中使每一item有不同的tip(2KB) 24,newctl.ZIP 动态创建控件的例子,解决了vb5中不能"无中生有"的毛病(2KB) 25,colourdg.ZIP 调用windows的颜色对话框, 不需用到...
本教程参考压缩包“VBScript 教程参考.zip”包含了一个名为“vbscript.chm”的帮助文件,这通常是一个微软编写的 Compiled Help Manual(CHM)格式的文档,用于详细解释VBScript的各种概念、语法和功能。 VBScript...
在MFC应用程序中浏览PDF、Word文档文件 vcdialog 自绘对话框。 vc编程:自动停靠窗体,吸附窗体 OnMoving事件处理。 vc基于HTTP协议断点续传和多线程下载源代码 VC满屏开满玫瑰花 VC然输入框出现气球提示 调用...
在MFC应用程序中浏览PDF、Word文档文件 vcdialog 自绘对话框。 vc编程:自动停靠窗体,吸附窗体 OnMoving事件处理。 vc基于HTTP协议断点续传和多线程下载源代码 VC满屏开满玫瑰花 VC然输入框出现气球提示 调用...
独立打包,保证可解压,内含大量源码,网上搜集...在MFC应用程序中浏览PDF、Word文档文件 vcdialog 自绘对话框。 vc编程:自动停靠窗体,吸附窗体 OnMoving事件处理。 vc基于HTTP协议断点续传和多线程下载源代码 VC...
在MFC应用程序中浏览PDF、Word文档文件 vcdialog 自绘对话框。 vc编程:自动停靠窗体,吸附窗体 OnMoving事件处理。 vc基于HTTP协议断点续传和多线程下载源代码 VC满屏开满玫瑰花 VC然输入框...
如果不能在启动目录(默认为 %systemroot%System32)中找到该文件,将试着在 Windows 安装 CD 中找到它。如果有多引导系统的计算机,必须保证是在包含 Windows 的驱动器上使用该命令。 Diskpart 创建和删除硬盘...
这个类是你所需的,下载一个回去试试,分析分析一定会有收获(85KB)<END><br>16,flat_comb.zip 你有没有想过在你的应用程序中加入"浮动"的组合框,就象Microsoft Office中的那样?用这个类就能轻松搞定(21KB)<END>...
07.zip CDialog using animated control 在CDialog中使用动画(12KB)<END><br>8,08.zip Open Dialog with Bitmap Preview 位图预览的打开文件对话框(43KB)<END><br>9,09.zip Standard file open ...
mruxdzip.exe 在菜单上最近打开文件的历史记录控件(1453KB) 2,applogger.zip 具有删除到回收站、读写 INI 文件、计算剩余磁盘空间,复制文件和添加到 Windows 文档列表(57KB) 3,ccrpbd10.zip ...
07.zip Creating a Property Sheet Inside a Form View - Asaf Levy 在Form View中创建属性页(4KB)<END><br>4,08.zip Creating a Property Sheet Inside a Dialog 在对话框中创建属性页(3KB)<END><br>...
(30KB) 58,sclcon.zip 不知道你对ie里背景的水印属性有没有印象,现在你在窗体里也可以实现了(162KB) 59,submenu.zip 可以在VB中自定义弹出式子菜单(8KB) 60,zlibtool.zip 较好的一个有进度显示...
(30KB) 58,sclcon.zip 不知道你对ie里背景的水印属性有没有印象,现在你在窗体里也可以实现了(162KB) 59,submenu.zip 可以在VB中自定义弹出式子菜单(8KB) 60,zlibtool.zip 较好的一个有进度显示...
实例222 复制文件时显示复制进度 310 实例223 批量复制文件 312 6.6 指定类型的文件操作 313 实例224 文本文件的操作 313 实例225 使用ROT13加密解密文件 314 6.7 其他 315 实例226 获取窗口文本 315 实例227...
如办公软件(Microsoft Office或WPS),图像处理软件(Photoshop),解压缩工具(WinRAR、7Zip),系统优化和安全工具(360安全卫士、Windows优化大师),杀毒软件(瑞星、卡巴斯基等),通讯软件(QQ、MSN),浏览器(遨游...