微软有篇文章: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
用asp实现网页调用doc附Response.ContentType 详细列表
内容版权声明:除非注明,否则皆为本站原创文章。