Response.ContentType 网页输出word excel 的格式

Response.ContentType 网页输出word excel 的格式不同的ContentType会影响客户端所看到的效果.默认的ContentType为text/html也就是网页格式.代码如:显示的为网页,而则会显示html原代码.以下为一些常用的ContentTypeGIFimagesJPEGimagesTIFFimagesMICROSOFTWORDdocument

大家好,又见面了,我是你们的朋友全栈君。 

不同的ContentType 会影响客户端所看到的效果.默认的ContentType为 text/html 也就是网页格式.
代码如:

<% response.ContentType =”text/html” %>
<!–#i nclude virtual=”/ContentType.html” –>

显示的为网页,而

<% response.ContentType =”text/plain” %>
<!–#i nclude virtual=”/sscript/ContentType.html” –>

则会显示html原代码.

以下为一些常用的 ContentType
GIF images

<% response.ContentType =”image/gif” %>
<!–#i nclude virtual=”/myimage.gif” –>

JPEG images

<% response.ContentType =”image/jpeg” %>
<!–#i nclude virtual=”/myimage.jpeg” –>

TIFF images

<% response.ContentType =”image/tiff” %>
<!–#i nclude virtual=”/myimage.tiff” –>

MICROSOFT WORD document

<% response.ContentType =”application/msword” %>
<!–#i nclude virtual=”/myfile.doc” –>

RTF document

<% response.ContentType =”application/rtf” %>
<!–#i nclude virtual=”/myfile.rtf” –>

MICROSOFT EXCEL document

<% Response.ContentType = “application/vnd.ms-excel” %>
<!–#i nclude virtual=”/myfile.xls” –>

MICROSOFT POWERPOINT document

<% response.ContentType =”application/ms-powerpoint” %>
<!–#i nclude virtual=”/myfile.pff” –>

PDF document

<% response.ContentType =”application/pdf” %>
<!–#i nclude virtual=”/myfile.pdf” –>

ZIP document

<% response.ContentType =”application/zip” %>
<!–#i nclude virtual=”/myfile.zip” –>

下面是更周详的ContentType
‘ez’ => ‘application/andrew-inset’,
‘hqx’ => ‘application/mac-binhex40’,
‘cpt’ => ‘application/mac-compactpro’,
‘doc’ => ‘application/msword’,
‘bin’ => ‘application/octet-stream’,
‘dms’ => ‘application/octet-stream’,
‘lha’ => ‘application/octet-stream’,
‘lzh’ => ‘application/octet-stream’,
‘exe’ => ‘application/octet-stream’,
‘class’ => ‘application/octet-stream’,
‘so’ => ‘application/octet-stream’,
‘dll’ => ‘application/octet-stream’,
‘oda’ => ‘application/oda’,
‘pdf’ => ‘application/pdf’,
‘ai’ => ‘application/postscript’,
‘eps’ => ‘application/postscript’,
‘ps’ => ‘application/postscript’,
‘smi’ => ‘application/smil’,
‘smil’ => ‘application/smil’,
‘mif’ => ‘application/vnd.mif’,
‘xls’ => ‘application/vnd.ms-excel’,
‘ppt’ => ‘application/vnd.ms-powerpoint’,
‘wbxml’ => ‘application/vnd.wap.wbxml’,
‘wmlc’ => ‘application/vnd.wap.wmlc’,
‘wmlsc’ => ‘application/vnd.wap.wmlscriptc’,
‘bcpio’ => ‘application/x-bcpio’,
‘vcd’ => ‘application/x-cdlink’,
‘pgn’ => ‘application/x-chess-pgn’,
‘cpio’ => ‘application/x-cpio’,
‘csh’ => ‘application/x-csh’,
‘dcr’ => ‘application/x-director’,
‘dir’ => ‘application/x-director’,
‘dxr’ => ‘application/x-director’,
‘dvi’ => ‘application/x-dvi’,
‘spl’ => ‘application/x-futuresplash’,
‘gtar’ => ‘application/x-gtar’,
‘hdf’ => ‘application/x-hdf’,
‘js’ => ‘application/x-javascript’,
‘skp’ => ‘application/x-koan’,
‘skd’ => ‘application/x-koan’,
‘skt’ => ‘application/x-koan’,
‘skm’ => ‘application/x-koan’,
‘latex’ => ‘application/x-latex’,
‘nc’ => ‘application/x-netcdf’,
‘cdf’ => ‘application/x-netcdf’,
‘sh’ => ‘application/x-sh’,
‘shar’ => ‘application/x-shar’,
‘swf’ => ‘application/x-shockwave-flash’,
‘sit’ => ‘application/x-stuffit’,
‘sv4cpio’ => ‘application/x-sv4cpio’,
‘sv4crc’ => ‘application/x-sv4crc’,
‘tar’ => ‘application/x-tar’,
‘tcl’ => ‘application/x-tcl’,
‘tex’ => ‘application/x-tex’,
‘texinfo’ => ‘application/x-texinfo’,
‘texi’ => ‘application/x-texinfo’,
‘t’ => ‘application/x-troff’,
‘tr’ => ‘application/x-troff’,
‘roff’ => ‘application/x-troff’,
‘man’ => ‘application/x-troff-man’,
‘me’ => ‘application/x-troff-me’,
‘ms’ => ‘application/x-troff-ms’,
‘ustar’ => ‘application/x-ustar’,
‘src’ => ‘application/x-wais-source’,
‘xhtml’ => ‘application/xhtml+xml’,
‘xht’ => ‘application/xhtml+xml’,
‘zip’ => ‘application/zip’,
‘au’ => ‘audio/basic’,
‘snd’ => ‘audio/basic’,
‘mid’ => ‘audio/midi’,
‘midi’ => ‘audio/midi’,
‘kar’ => ‘audio/midi’,
‘mpga’ => ‘audio/mpeg’,
‘mp2’ => ‘audio/mpeg’,
‘mp3’ => ‘audio/mpeg’,
‘aif’ => ‘audio/x-aiff’,
‘aiff’ => ‘audio/x-aiff’,
‘aifc’ => ‘audio/x-aiff’,
‘m3u’ => ‘audio/x-mpegurl’,
‘ram’ => ‘audio/x-pn-realaudio’,
‘rm’ => ‘audio/x-pn-realaudio’,
‘rpm’ => ‘audio/x-pn-realaudio-plugin’,
‘ra’ => ‘audio/x-realaudio’,
‘wav’ => ‘audio/x-wav’,
‘pdb’ => ‘chemical/x-pdb’,
‘xyz’ => ‘chemical/x-xyz’,
‘bmp’ => ‘image/bmp’,
‘gif’ => ‘image/gif’,
‘ief’ => ‘image/ief’,
‘jpeg’ => ‘image/jpeg’,
‘jpg’ => ‘image/jpeg’,
‘jpe’ => ‘image/jpeg’,
‘png’ => ‘image/png’,
‘tiff’ => ‘image/tiff’,
‘tif’ => ‘image/tiff’,
‘djvu’ => ‘image/vnd.djvu’,
‘djv’ => ‘image/vnd.djvu’,
‘wbmp’ => ‘image/vnd.wap.wbmp’,
‘ras’ => ‘image/x-cmu-raster’,
‘pnm’ => ‘image/x-portable-anymap’,
‘pbm’ => ‘image/x-portable-bitmap’,
‘pgm’ => ‘image/x-portable-graymap’,
‘ppm’ => ‘image/x-portable-pixmap’,
‘rgb’ => ‘image/x-rgb’,
‘xbm’ => ‘image/x-xbitmap’,
‘xpm’ => ‘image/x-xpixmap’,
‘xwd’ => ‘image/x-xwindowdump’,
‘igs’ => ‘model/iges’,
‘iges’ => ‘model/iges’,
‘msh’ => ‘model/mesh’,
‘mesh’ => ‘model/mesh’,
‘silo’ => ‘model/mesh’,
‘wrl’ => ‘model/vrml’,
‘vrml’ => ‘model/vrml’,
‘css’ => ‘text/css’,
‘html’ => ‘text/html’,
‘htm’ => ‘text/html’,
‘asc’ => ‘text/plain’,
‘txt’ => ‘text/plain’,
‘rtx’ => ‘text/richtext’,
‘rtf’ => ‘text/rtf’,
‘sgml’ => ‘text/sgml’,
‘sgm’ => ‘text/sgml’,
‘tsv’ => ‘text/tab-separated-values’,
‘wml’ => ‘text/vnd.wap.wml’,
‘wmls’ => ‘text/vnd.wap.wmlscript’,
‘etx’ => ‘text/x-setext’,
‘xsl’ => ‘text/xml’,
‘xml’ => ‘text/xml’,
‘mpeg’ => ‘video/mpeg’,
‘mpg’ => ‘video/mpeg’,
‘mpe’ => ‘video/mpeg’,
‘qt’ => ‘video/quicktime’,
‘mov’ => ‘video/quicktime’,
‘mxu’ => ‘video/vnd.mpegurl’,
‘avi’ => ‘video/x-msvideo’,
‘movie’ => ‘video/x-sgi-movie’,
‘ice’ => ‘x-conference/x-cooltalk’

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/161591.html原文链接:https://javaforall.net

(0)
上一篇 2022年7月19日 下午4:16
下一篇 2022年7月19日 下午4:16


相关推荐

  • Java实现远程开关机(网络唤醒)

    Java实现远程开关机(网络唤醒)Java实现远程开关机是做的一个在局域网下实现一台机器对多台机器的开关机控制远程唤醒实现是通过电源的一种协议进行控制的,需要知道被唤醒机器的mac地址首先要须知:网络唤醒条件网络唤醒需要终端的主板和网卡支持,需要先在BIOS设置支持网络唤醒网络唤醒要接通电源保证网卡能通电要接网线不能是wifi如果强制关机可能不能通过网络唤醒来开机跨交换机或者跨路由的话就有可能不支持唤醒跨多…

    2022年6月2日
    44
  • tensorflow2.0手写数字识别_tensorflow手写汉字识别

    tensorflow2.0手写数字识别_tensorflow手写汉字识别手写识别的应用场景有很多,智能手机、掌上电脑的信息工具的普及,手写文字输入,机器识别感应输出;还可以用来识别银行支票,如果准确率不够高,可能会引起严重的后果。当然,手写识别也是机器学习领域的一个HelloWorld任务,感觉每一个初识神经网络的人,搭建的第一个项目十之八九都是它。我们来尝试搭建下手写识别中最基础的手写数字识别,与手写识别的不同是数字识别只需要识别0-9的数字,样本数据集也只需…

    2025年11月15日
    3
  • [基础控件]—状态切换控件CompoundButton及其子类CheckBox、RadioButton、ToggleButton、switch事件监听与场景使用

    [基础控件]—状态切换控件CompoundButton及其子类CheckBox、RadioButton、ToggleButton、switch事件监听与场景使用一、事件监听对于普通的Button,对其进行事件监听Google官方给出了常见的三种监听方式:1、对每一个button设置事件监听器button.setOnClickListener(View.Onc

    2022年7月1日
    19
  • 阿里云Ubuntu部署java web(2) – 配置tomcat「建议收藏」

    阿里云Ubuntu部署java web(2) – 配置tomcat

    2022年1月27日
    44
  • SS加密方式浅析

    SS加密方式浅析注 参考资料忘记保存 仅凭记忆简单区别 前言理清概念 加密仅保证报文内容不被其他人探知 并不能保证报文的内容不被修改 所以需要消息完整性校验 RC4 MD5 速度最快但加密简单 易激活成功教程 rc4 加密 md5 校验 AES 区别 AES XXX CFBAES XXX CTRAES XXX GCM 定义 GMAC 伽罗瓦消息验证码 CTR 区别仅加密

    2026年3月17日
    2
  • MidJourney本地部署

    MidJourney本地部署

    2026年3月15日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号