Hello Guys,
How can i display the content of MS Word document to my ASP page?
How can i upload ms word document?
How can i download ms word document from the page?

Hope somebody would respond.
regards,
AV

Recommended Answers

All 20 Replies

<%
filePath = "path to the word file"
response.Buffer = true
response.Clear
response.ContentType = "application/ms-word"
response.CacheControl = "no-store"

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile filePath
response.BinaryWrite objStream.Read
objStream.Close
response.Flush
response.End
%>

MS Word must exist on the client machine for this to work of course.

<%
filePath = "path to the word file"
response.Buffer = true
response.Clear
response.ContentType = "application/ms-word"
'response.CacheControl = "no-store"

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile filePath
response.BinaryWrite objStream.Read
objStream.Close
response.Flush
response.End
%>

i commented out this line: 'response.CacheControl = "no-store"', IE has an issue wqith this line. If it needs to put the document in local cache so the it can then open it in word from there. Firefox has no problem eith this directive left in.

For uploading there are two options.

1. Purchase an upload component, I recommend ABCUpload but it's not the only one out there. One of my sites uses ASPUpload, but I find the other one more functional and easier to use.

2. Find the upload code on the web, it's out there, but it's not for the faint hearted.


And in regards to Word being required on the client, technically it will be happy with whichever application is associated with the ms-word mime type. Hence open office is perfectly acceptable in most situations.

For showing it in the current window use
Response.AddHeader "content-disposition","inline; filename=" & strFileName

For opening outside IE (or whatever) use
Response.AddHeader "content-disposition","attachment; filename=" & strFileName

Hope this helps

D

Hollystyles,
I have practiced your code. But it doesn't working properly. I use to save your code for making this, and saved it with .asp and run it. But it is asking for downloading. And moreover, it is detected as Photoshop file. If we click the open command, it would direct to photoshop and displays no result. If we click the save button, then it is saved as .asp file. What is this? Hope you would seriously consider this matter.

What I have done is:
Copied your code to a notepad and save as 'word.asp' and stored in wwwroot directory.
Created a word file name 'anish.doc' and saved it in C: drive.
I have made changes to your code with this path. (C drive)
Open IE and type http://localhost/word.asp.

Please supply me with a full source code of ASP. I hope you would mind my request.
regards,
AV

<% @Language=VBScript %>

<%
Option Explicit

Dim fileName, filePath, contentType, objStream

fileName = "anish.doc"
filePath = "C:\" & fileName
contentType = "application/msword"

Response.Buffer = true
Response.Clear
Response.ContentType = contentType
'Response.CacheControl = "no-cache"  'issue for IE no-store doesn't work either
Response.Addheader "ContentType", contentType
Response.Addheader "Content-Disposition", "inline; filename=" & fileName

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile filePath
response.BinaryWrite objStream.Read
objStream.Close

Response.Flush
Response.End
%>

Hollystyles,
Thanks code sounds good. But displaying error at IE. Below is the output:

ÐÏࡱá>þÿ !#þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Á7 ð¿bjbjUU " 7|7|ÿÿÿÿÿÿlFFFFFFFZtttt € Z3˜˜˜˜˜˜ÖØØØØØØ! A"ØF˜˜˜˜˜ØÎFF˜˜íÎÎΘF˜F˜ÖΘÖÎÎÖFFÖ˜Œ °•º†¶qÇZt®ÖÖ03Öc¾cÖÎZZFFFFÙHello How are you o fine here íæ CJOJQJ#5B*CJOJQJ\^JaJphýþ 1h°Ð/ °à=!°"°# $ %° i8@ñÿ8 NormalCJ_HaJmH sH tH *CJOJQJ\]€^JaJo(ph:&X@¢& Emphasis6]"W@¢" Strong5\ ÿÿÿÿ š0€€ ÿÿAnish Varghese9E:\Documents and Settings\Anish\Desktop\English Bites.docAnish Varghese C:\anish.docAnish Varghese C:\anish.docÿ@@@ÿÿUnknownÿÿÿÿÿÿÿÿÿÿÿÿG‡z €ÿTimes New Roman5€Symbol3& ‡z €ÿArial7& ‡ ŸVerdana"ñˆðÐhMѳ&úä³fÁð ´´r02ƒðÿÿ`Anne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahAnish VargheseAnish Vargheseþÿà…ŸòùOh«‘+'³Ù0Ô˜(4@P ht œ ¨´¼ÄÌäaAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahdnneAnish VargheseanisnisNormalaAnish Varghesea5isMicrosoft Word 9.0 @ @ÖFz¨oÇ@T+q¶qÇþÿÕÍÕœ.“—+,ù®0H hp|„Œ” œ¤¬´ ¼ )ä aAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, Sarah Titleþÿÿÿ þÿÿÿþÿÿÿþÿÿÿýÿÿÿ"þÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀF0°À†¶qÇ$€1TableÿÿÿÿÿÿÿÿÿÿÿÿWordDocumentÿÿÿÿÿÿÿÿSummaryInformation(ÿÿÿÿDocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿCompObjÿÿÿÿjObjectPoolÿÿÿÿÿÿÿÿÿÿÿÿ0°À†¶qÇ0°À†¶qÇÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿ ÿÿÿÿ ÀFMicrosoft Word Document MSWordDocWord.Document.8ô9²q

Hollystyles,
Thanks code sounds good. But displaying error at IE. Below is the output:

ÐÏࡱá>þÿ !#þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Á7 ð¿bjbjUU " 7|7|ÿÿÿÿÿÿlFFFFFFFZtttt € Z3˜˜˜˜˜˜ÖØØØØØØ! A"ØF˜˜˜˜˜ØÎFF˜˜íÎÎΘF˜F˜ÖΘÖÎÎÖFFÖ˜Œ °•º†¶qÇZt®ÖÖ03Öc¾cÖÎZZFFFFÙHello How are you o fine here íæ CJOJQJ#5B*CJOJQJ\^JaJphýþ 1h°Ð/ °à=!°"°# $ %° i8@ñÿ8 NormalCJ_HaJmH sH tH *CJOJQJ\]€^JaJo(ph:&X@¢& Emphasis6]"W@¢" Strong5\ ÿÿÿÿ š0€€ ÿÿAnish Varghese9E:\Documents and Settings\Anish\Desktop\English Bites.docAnish Varghese C:\anish.docAnish Varghese C:\anish.docÿ@@@ÿÿUnknownÿÿÿÿÿÿÿÿÿÿÿÿG‡z €ÿTimes New Roman5€Symbol3& ‡z €ÿArial7& ‡ ŸVerdana"ñˆðÐhMѳ&úä³fÁð ´´r02ƒðÿÿ`Anne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahAnish VargheseAnish Vargheseþÿà…ŸòùOh«‘+'³Ù0Ô˜(4@P ht œ ¨´¼ÄÌäaAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahdnneAnish VargheseanisnisNormalaAnish Varghesea5isMicrosoft Word 9.0 @ @ÖFz¨oÇ@T+q¶qÇþÿÕÍÕœ.“—+,ù®0H hp|„Œ” œ¤¬´ ¼ )ä aAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, Sarah Titleþÿÿÿ þÿÿÿþÿÿÿþÿÿÿýÿÿÿ"þÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀF0°À†¶qÇ$€1TableÿÿÿÿÿÿÿÿÿÿÿÿWordDocumentÿÿÿÿÿÿÿÿSummaryInformation(ÿÿÿÿDocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿCompObjÿÿÿÿjObjectPoolÿÿÿÿÿÿÿÿÿÿÿÿ0°À†¶qÇ0°À†¶qÇÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿ ÿÿÿÿ ÀFMicrosoft Word Document MSWordDocWord.Document.8ô9²q

Hollystyles,
Thanks code sounds good. But displaying error at IE. Below is the output:


ÿÿAnish Varghese9E:\Documents and Settings\Anish\Desktop\English Bites.docAnish Varghese C:\anish.docAnish Varghese C:\anish.docÿ@@@ÿÿUnknownÿÿÿÿÿÿÿÿÿÿÿÿG‡z €ÿTimes New Roman5€Symbol3& ‡z €ÿArial7& ‡ ŸVerdana"ñˆðÐhMѳ&úä³fÁð ´´r02ƒðÿÿ`Anne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahAnish VargheseAnish Vargheseþÿà…ŸòùOh«‘+'³Ù0Ô˜(4@P ht œ ¨´¼ÄÌäaAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, SarahdnneAnish VargheseanisnisNormalaAnish Varghesea5isMicrosoft Word 9.0 @ @ÖFz¨oÇ@T+q¶qÇþÿÕÍÕœ.“—+,ù®0H hp|„Œ” œ¤¬´ ¼ )ä aAnne, a wine dealer from Singapore, arrives at Adelaide Airport and meets her local buyer, Sarah Titleþÿÿÿ þÿÿÿþÿÿÿþÿÿÿýÿÿÿ"þÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀF0°À†¶qÇ$€1TableÿÿÿÿÿÿÿÿÿÿÿÿWordDocumentÿÿÿÿÿÿÿÿSummaryInformation(ÿÿÿÿDocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿCompObjÿÿÿÿjObjectPoolÿÿÿÿÿÿÿÿÿÿÿÿ0°À†¶qÇ0°À†¶qÇÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿ ÿÿÿÿ ÀFMicrosoft Word Document MSWordDocWord.Document.8ô9²q

Hollystyles,
Thanks, code sounds good. But displaying error at IE. Below is the output:

Did you use the later code I posted? after davidcairns' post in which I added these two lines

Response.Addheader "ContentType", contentType
Response.Addheader "Content-Disposition", "inline; filename=" & fileName

I was getting the same result as you on my PC until I added those two lines, also I had to close down and restart IE so it didn't use the local cache (you know temporary internet files) and It works fine on my PC now.

Dear Holystyle,
Now I got. It is working properly. Thanks in advance. Now i'm vacating from this thread.
Thanking you,

Anish
Mahatma Gandhi Colony

hello everyone,
i must dislay a word document into a asp page.
i tried with iframe but it didn't work proprely so i need ur help.
I have this .doc document with some text into, and i have to display the document into my website, in a page written in ASP.
i tried with the code in this discuss but it work only like a download, but i wanna display the contenent of the page into the browser without manual download.
hope u can help me,
regards
:)

Hi,
Try this code: Make changes to file name and location

<% @Language=VBScript %>
<%
Option Explicit
Dim fileName, filePath, contentType, objStream
fileName = "anish.doc"
filePath = "C:\" & fileName
contentType = "application/msword"
Response.Buffer = true
Response.Clear
Response.ContentType = contentType
'Response.CacheControl = "no-cache"
'issue for IE no-store doesn't work either
Response.Addheader "ContentType", contentType
Response.Addheader "Content-Disposition", "inline; filename=" & fileName
Set objStream = Server.CreateObject("ADODB.Stream")objStream.Open
objStream.Type = 1
objStream.LoadFromFile filePath
response.BinaryWrite objStream.Read
objStream.Close
Response.Flush
Response.End
%>

This code had already submitted by somebody. I hope this would help to rectify your problem. try this code and send feedback to this thread.

it works but it isn't what i meant .
This code "asks" me to download or save the file like a normal link 4 the download does, but it isn't what i want.
I want a code that allows me to view a document into the browser and not a code like urs that i have to download before i can view it.
can u help me out??thanx so much

2 things to note here

1. If you want to use MS Word integrated into the browser it will still depend to some extent on the users client settings, ie whether word is allowed to integrate with IE, Firefow, Opera or whatever they have. Even if you say inline on the disposition that doesn't mean the client is required to treat it that way.

2. If you actually want to display the contents in an HTML page then you may have to convert the word document to HTML or Text

i've just tried point 2 but the text format and the alignment of the columns aren't like in the original document. moreover, i haven't understood what u meant in point 1! could u explain it again, please????thanx so much!

furianera,

Please submit the full procedure that you have done in this business. I hope you don't have MSOffice installed on your computer. Go to internet explorer, click tools menu and internet option. Then go to Advanced Tab and click Reset Advanced settings.
------------------------------------------
1. You have to save the below mentioned code with the extension as .asp.
You have to edit the location specified in tht code, with your document name, and location.
And disposed it in your inetpub/wwwroot/ folder.
Type http://localhost/'filename.asp' at the address bar and press enter.

Because it is functioning properly in my computer.
------------------------------------------
2. Or if you want to make it as a text format, open the said document thorugh MS word, click file menu and select Save As Web page. That is all. And run it (Double click).

Good Luck

HelloDear well in my laptop i've installed openoffice, and i have reset all the advanced options of IE.
i've just done all the things that u mean in the point 1, run the .asp file in my ie but my browser still asks me the download of the file and it doesn't open the document directly in the browser. so i don't understand your point.
Point 2:
i've just done also this way, but the results isn't good so i want the document (.doc) to be opened into the browser.
Today i tried this code:

<% response.ContentType ="application/msword" %>  
<!--#include virtual="/myfile.doc" -->

but still works like a download..
i apologise for all the drawbacks :(

good thread, but final output is not happy, any how it bring experience on the Concept.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.