微软有篇文章: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 第五步:存盘 第六步:编译