Naild
05-25-2006, 04:14 AM
I was wondering if it's possible to write a Microsoft Word document that has been saved as an HTML document to a web page? Just like you would link to an external JavaScript like so-
<script type="text/javascript" src="MyScript.js"></script>
Or an external stylesheet like so-
<link rel="stylesheet" type="text/css" href="MyStylesheet.css">
I've already uploaded the MS Word document on a different server. So what I would like to do is link to it, and have it write the MS Word document as a web page. Is this possible?
Maybe something like this?
<script type="word.Document" src="MyWordDocument.html"></script>
Any input would be appreciated. Thank you.
djr33
05-25-2006, 07:27 AM
Yes. And no.
You can use a word document on the web and you can include one document in another, but you are going about it totally the wrong way.
Content on your page is neither a script nor a stylesheet... they are specific elements of your page that control how it functions... also, both are in the head section... note "head" vs. "body"... where the content goes.
To give you the easiest/best solution, more info about your particular reasons for doing this would be helpful.
However, here's a general overview:
SAVING WORD AS A WEBPAGE:
Just hit file>save as, and choose webpage. Or is it file> save as webpage? Might depend on version.
And you're done.
***PLEASE don't use MS Word to code webpages, though... it's got weird stuff going on and will give you headaches. But... it works if you have a .doc and want it on the web. Just don't use it for anything except saving stuff already as a .doc to display as html.
If you actually want the .doc extension and formatting without saving as a webpage, then, no, you can't show it on your page. But... you could upload both the .doc and converted .html versions.
Technically, it is possible, but word files have their own weird coding language (try opening one in notepad), so it would either be seen as a bunch of garbage with your text in the middle or you would need to write complex javascript/php/etc that would translate that into html formatting... but... ummmm... that's what the save as webpage option is for :)
INCLUDING ON YOUR PAGE OPTIONS:
You can just cut/paste into your html code. That's easiest.
You can use an iframe:
<iframe src="worddoc.html" width="200" height="200"></iframe>
You could use php*:
<?php include("worddoc.html"); ?>
*server must have php enabled/installed and your page must have a .php extension.
Similar to php, you can use SSI, server side includes... they are like a comment (<!-- ... -->) but have special code telling the server to "include page here", like the php above.
I don't have the specific code on hand at the moment, and you also need a server that supports this. I'd rather use php myself... your choice.
You can also use javascript, basically AJAX, to get the contents, store as a variable, then write them into the page. this is like php though, and since you don't need any client-side input/changes, php is probably a better/more secure option as well as being totally compatible unlike javascript... IF your host supports php. If not, try this.
So... hope that answered your question.
The easy answer is the iframe if you don't want it to be part of the other page.
The rest is a little more complex.
Basically... the above options will do what you want, and you should realize that the <script>, etc tags have NOTHING to do with this...
Hmm... now that I'm thinking about it, though, I wonder if you could shortcut stuff with the script tags... but.. no. The script tags add the script code to the page, but they also place it in between the opening and closing script tags... so it isn't normal html.
Interesting thought though...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.