Kürzlich habe ich untersucht, wie man DOC mit einer Webseite anruft. . Verwenden Sie DOC, um Binärdaten zu lesen und anzuzeigen.
ASP -Programm:
<%
response.buffer = true
Antwort.ContentType = application/x-msexcel
dimvntstream
setMyObject = server.createObject (myObject.binread) 'Diese Komponente wird später eingeführt
vntstream = omyObject.readBinfile (c: /temp/tempxls.xls)
response.binarywrite (vntstream)
setMyObject.Nothing
Antwort.end
%>
Kontrollcode:
Schritt 1: Erstellen Sie ein ActiveXdllProject in VB
Schritt 2: Ändern Sie den Projektnamen in MyObject
Schritt 3: Benennen Sie die Klasse in Binread um
Schritt 4: Schreiben Sie den folgenden Code im Klassenmodul
FunktionReadBInfile (ByvalbFilenameAsString)
Dimflaslong
Dimfilenumasbyte
Dimbinbyte () assstring
Filenum = FreeFile
OpenBFileNameForBinaryAccessReadas#Filenum
FL = Filelen (bfilename)
Redimbinbyte (FL)
Holen Sie sich#Filenum, Binbyte
Schließen#Filenum
ReadBinFile = Binbyte
Endfunktion
Schritt 5: Speichern
Schritt 6: Zusammenstellung
Mein Code kann aus irgendeinem Grund nicht online geöffnet werden:
<%
Response.buffer = true
Antwort.ContentType = Application/Msword
server.execute (111.doc)
%>
Beigefügt:
ASP: Antwort.ContentType Detaillierte Liste
Verschiedene ContentTypes beeinflussen den vom Client angezeigten Effekt.
Codes wie:
<%Antwort.ContentType = text/html%>
<!-# includevirtual =/contentType.html->
Die Seite wird angezeigt und
<%Antwort.ContentType = Text/Plain%>
<!-# includevirtual =/script/contentType.html->
Der ursprüngliche HTML -Code wird angezeigt.
Im Folgenden sind einige häufig verwendete ContentTypes aufgeführt
Gifiimages
<%Antwort.ContentType = Bild/GIF%>
<!-# includevirtual =/myimage.gif->
Jpegimages
<%Antwort.ContentType = Bild/JPEG%>
<!-# includevirtual =/myimage.jpeg->
Tiffiimages
<%Antwort.ContentType = Bild/Tiff%>
<!-# includevirtual =/myimage.tiff->
MicrosoftwordDocument
<%Antwort.ContentType = Application/Msword%>
<!-# includevirtual =/myFile.doc->
Rtfdocument
<%Antwort.ContentType = Application/RTF%>
<!-# includevirtual =/myfile.rtf->
Microsoftxceldocument
<%Antwort.ContentType = Application/x-excel%>
<!-# includevirtual =/myfile.xls->
MicrosoftPowerPointDocument
<%Antwort.ContentType = Application/MS-PowerPoint%>
<!-# includevirtual =/myfile.pff->
PDFDocument
<%Antwort.ContentType = Application/PDF%>
<!-# includevirtual =/myfile.pdf->
Zipdokument
<%Antwort.ContentType = Application/Zip%>
<!-# includevirtual =/myFile.zip->
Unten finden Sie ein detaillierterer ContentType
'ez' => 'Anwendung/Andrew-inSet',
'HQX' => 'Anwendung/Mac-Binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'Anwendung/msword',
'bin' => 'Anwendung/Oktettstream',
'DMS' => 'Anwendung/Oktettstrom',
'LHA' => 'Anwendung/Oktettstrom',
'lzh' => 'Anwendung/Oktettstrom',
'exe' => 'Anwendung/Oktettstrom',
'Klasse' => 'Anwendung/Oktettstream',
'so' => 'Anwendung/Oktettstream',
'dll' => 'Anwendung/Oktettstrom',
'oda' => 'Anwendung/ODA',
'PDF' => 'Anwendung/PDF',
'AI' => 'Anwendung/PostScript',
'EPS' => 'Anwendung/PostScript',
'PS' => 'Anwendung/PostScript',
'smi' => 'Anwendung/lächelnd',
'lächer' => 'Anwendung/lächer',
'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' => 'Anwendung/X-CSH',
'DCR' => 'Anwendung/X-Direktor',
'Dir' => 'Anwendung/X-Direktor',
'DXR' => 'Anwendung/X-Direktor',
'DVI' => 'Anwendung/x-dvi',
'spl' => 'application/x-futuresplash',
'gtar' => 'application/x-gtar',
'HDF' => 'Anwendung/X-HDF',
'JS' => 'Anwendung/X-JavaScript',
'skp' => 'application/x-koan',
'skd' => 'application/x-koan',
'Skt' => 'Anwendung/X-Koan',
'skm' => 'application/x-koan',
'latex' => 'application/x-latex',
'nc' => 'application/x-netcdf',
'CDF' => 'Anwendung/x-netcdf',
'sh' => 'Anwendung/x-sh',
'Shar' => 'Anwendung/x-shar',
'SWF' => 'Anwendung/X-Shockwave-Flash',
'Sit' => 'Anwendung/X-Stuffit',
'SV4CPIO' => 'Anwendung/X-SV4CPIO',
'sv4crc' => 'application/x-sv4crc',
'tar' => 'Anwendung/x-tar',
'tcl' => 'Anwendung/x-tcl',
'tex' => 'application/x-tex',
'texinfo' => 'Anwendung/x-texinfo',
'texi' => 'application/x-texinfo',
'T' => 'Anwendung/x-troff',
'tr' => 'Anwendung/x-troff',
'Roff' => 'Anwendung/x-troff',
'Man' => 'Anwendung/x-troff-Man',
'me' => 'application/x-troff-me',
'MS' => 'Anwendung/x-troff-ms',
'uswStar' => 'Anwendung/X-Usstar',
'src' => 'Anwendung/x-wais-source',
'xhtml' => 'Anwendung/xhtml+xml',
'xht' => 'Anwendung/xhtml+xml',
'Zip' => 'Anwendung/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' => 'Bild/BMP',
'GIF' => 'Bild/GIF',
'IEF' => 'Bild/ief',
'JPEG' => 'Bild/JPEG',
'JPG' => 'Image/JPEG',
'JPE' => 'Image/JPEG',
'png' => 'Bild/png',
'Tiff' => 'Bild/Tiff',
'Tif' => 'Bild/Tiff',
'djvu' => 'Bild/vnd.djvu',
'djv' => 'Bild/vnd.djvu',
'wbmp' => 'Bild/vnd.wap.wbmp',
'ras' => 'Bild/x-cmu-Raster',
'pnm' => 'Bild/x-portable-anymap',
'pbm' => 'Bild/x-portable-bitmap',
'pgm' => 'Bild/x-portable-graymap',
'ppm' => 'Bild/x-portable-pixmap',
'rgb' => 'Bild/x-rgb',
'xbm' => 'Bild/x-xbitmap',
'xpm' => 'Bild/x-xpixmap',
'xwd' => 'Bild/x-xwindowdump',
'IGS' => 'Modell/Iges',
'iges' => 'Modell/IGES',
'MSH' => 'Modell/Mesh',
'mesh' => 'Modell/Mesh',
'Silo' => 'Modell/Mesh',
'wrl' => 'Modell/vrml',
'vrml' => 'Modell/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/tabendetriebene Werte',
'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' '