|
|
 |
| HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the HTML Code Clinic section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

August 17th, 2009, 10:39 AM
|
|
Authorized User
|
|
Join Date: Jun 2007
Location: Tehran, Tehran, Iran.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to embed Word document in HTML page!
Hi everybody
I Have to display a word document in my webpage. Our web application is running under trusted security policy with full permissions (on an intranet). All browsers are IE. There is a way (as I knew) using OBJECT tag. I know how to use this tag to include external objects on my HTML page (like SWF, PDF, etc). But it seems it doesn't work for Word documents. I'm trying the following code (simplified here) on different clients having Office 2003 or 2007 installed, using doc/docx file type:
<html>
<body>
<object id="msword" width="100%" height="100%"
classid="CLSID:00020906-0000-0000-C000-000000000046"
data='http://localhost/testword/test.doc'>
</object>
</body>
</html>
When I open this page on my browser, it loads successfully without any error. But nothing appears on screen. It seems that Word object is loaded by browser (I can see WINWORD.exe on my process list using Task Manager) and fills the given area on the screen. I mean, when I right-click on different regions of my page, all the regions occupied by word object, prevents browser context menu to appear. Also the given file is downloaded from server successfully (as I changed the file address to some invalid name, a red cross apeared in place of Word object, indicating 404 HTTP error).
Some guys suggest to use IFRAME instead of OBJECT tag and set its src to given doc file. But in this scenario, browser tries to save/open given file and save/open dialogue appears on screen.
Now, I don't know what should I do and what to try.
- Is it possible to display a word document in HTML page in this way or it's completely impossile due to some technical issues ?
For example, Word OLE mechanism may not support to be hosted on a container like IE. This is my guess because when I try to open a pdf document using browser's file open dialogue, IE loads Adobe Acrobat Reader inside itself through OLE mechanism and let it handle displaying pdf file by itself. But when I try the same for a doc/docx file, file save/open dialogue appears and browser tries to download and save/open the given document.
- Do I have to try some special attributes on my OBJECT tag ?
I've already tried type attribute with different mime-type values I'd found for doc/docx document, but nothing happened
- Should I set some special mime-type on my server so that IE knows what is coming from server side?
As IE uses client's windows registery to lookup clsid of Microsoft Word, I think it's reading a mime-type associated to this clsid too.
However, I'm waiting for you guys. Please help me or tell me that it's completely impossible and make me relax 
__________________
Ehsan Zaery Moghaddam
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |