• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ASP > 用asp实现网页调用doc附Response.ContentType 详细列表

用asp实现网页调用doc附Response.ContentType 详细列表

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了response.contenttype,contenttype,setcontenttype,contenttype类型,ajax contenttype等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
微软有篇文章:http://support.microsoft.com/kb/193998/zh-cn,用doc读取和显示二进制数据,《怎样读取二进制文件》,没测试,懒得编译dll   
asp程序:   
<%   
        response.buffer=true   
        response.contenttype="application/x-msexcel"   
        dim   vntstream   
        set   oMyObject=server.createObject("MyObject.BinRead")'这个组件后面介绍   
        vntstream=oMyObject.readBinfile("c:\temp\tempxls.xls")   
        response.binarywrite(vntstream)   
        set   oMyObject.Nothing   
        response.end   
%>   

控件代码:   
第一步:在VB中创建一个ActiveX   DLL   Project   
第二步:把工程名改为MyObject   
第三步:把class更名为BinRead   
第四步:在class模块中写上以下代码   
Function   readBinFile(ByVal   bfilename   As   String)   
            Dim   fl   As   Long   
            Dim   FileNum   As   Byte   
            Dim   binbyte()   As   String   

            FileNum   =   FreeFile   
            Open   bfilename   For   Binary   Access   Read   As   #FileNum   

            fl   =   FileLen(bfilename)   
            ReDim   binbyte(fl)   

            Get   #FileNum,   ,   binbyte   

            Close   #FileNum   
            readBinFile   =   binbyte   
End   Function   
第五步:存盘   
第六步:编译   


我的代码,不知为什么可以保存,在线打不开:

<%
Response.Buffer   =   TRUE
response.ContentType="application/msword"
server.Execute("111.doc") 
%>

附:

ASP:Response.ContentType 详细列表
不同的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/x-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' => 'ap
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 用asp实现网页调用doc附Response.ContentType 详细列表

相关文章

  • 2017-05-11小偷&小偷入库&采集入库
  • 2017-05-11asp 常用函数用法
  • 2017-05-11ASP控制每页打印行数
  • 2017-05-11ASP使用MySQL数据库的方法
  • 2017-05-11清空iis log 中自己登录ip的vbs
  • 2017-05-11ReplaceTrim 函数之asp实现过滤掉字符中所有的tab和回车和换行的代码
  • 2017-05-11禁止站外提交表单
  • 2017-05-11asp知识整理笔记4(问答模式)
  • 2017-05-11asp终极防范SQL注入漏洞
  • 2017-05-11关于用ADO STREAM做的无组件上传程序简单介绍

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • ASP出现问题?修复ASP的批处理
    • ASP程序中常用的脚本语言
    • asp中用数据库生成不重复的流水号
    • asp下根据标题生成关键字的代码
    • 抽取10万条数据,想起GetRows()
    • msxml3.dll 错误 '800c0005'解决方案
    • HTML标签及ASP函数速查表
    • asp又一个分页的代码例子
    • ASP编程入门进阶(十四):Browser & Linking
    • ASP基础入门第四篇(脚本变量、函数、过程和条件语句)

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有