加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

用asp实现网页调用doc附Response.ContentType 具体列表

发布时间:2023-08-28 10:59:38 所属栏目:Asp教程 来源:
导读:微软有篇文章:http://support.microsoft.com/kb/193998/zh-cn,用doc读取和显示二进制数据,《怎样读取二进制文件》,没测试,懒得编译dll
asp程序:
<%
response.buffer=true
respons
微软有篇文章: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   

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章