Displaying documents on a web page  
Author Message
Cartman7878





PostPosted: XML and the .NET Framework, Displaying documents on a web page Top

Hi

I want to be able to display Word documents on a page in our Company Intranet without opening a new browser window, ie. embedded into the actual page.

Does anyone know how to go about this as i'm struggling to find a way to do it. I thought about saving the documents as XML files, is this a viable option

I'm using VB.NET 2005.

Any help greatly appreciated!



.NET Development4  
 
 
Indian Ocean





PostPosted: XML and the .NET Framework, Displaying documents on a web page Top

I think this is not the right forum for such questions. [Note: this is xml related forum, you should go to http://forums.asp.net]

The answer is:

1. The simplest way: put the word documents under one directory in your website somewhere... e.g lets say your site virtual dir name is "YourSite", and under that "docs" folder which contains your all documents then
http://<yourdomainurl-YourSite>/docs/YourDocument.doc
If you access this URL then it will open the word document in Webbrowser (embedded)

2. Create a webpage which reads the word document file using IO APIs and then write the bytes on response stream, it will show the word document in that webpage.



Response.ContentType = "application/msword";
FileStream fs =
new
byte[] b = new byte[(int)fs.Length];
fs.Read(b,0, (int)fs.Length);
fs.Close();
Response.Clear();
Response.BinaryWrite(b);
Response.End();

The above code will write your word file into the browser.

HTH,



 
 
Ashrafali





PostPosted: XML and the .NET Framework, Displaying documents on a web page Top

Thankyou very much,

Thanks for giving solution but I want to show word document in panel or frame on webpage. If you have any idea regarding this so please help me.

Thanking you.

ASH002