Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making Word document embedded in a web page editable or read-only

I'm embedding some Word documents into our web page using iframe like this:

<iframe src="ftp://ftp.example.com/www/uploads/Image/test.doc" width="100%" height="400">  
    Alternative
</iframe>

The problem is that the embedded Word control allows the user to edit the documents and shows an icon to save them, but doesn't actually save anything. Is it possible to setup Word to save edits back to the FTP server? If not, is there someway we can make the document read-only so the user doesn't get the idea that they can make changes? We're using IE7 and Word 2003.

(I just asked a related question about getting Word to save to a FTP server: Possible for Word to edit documents directly off an web server without Sharepoint?)

like image 470
gerdemb Avatar asked Nov 05 '22 21:11

gerdemb


2 Answers

You can use ActiveX component like EDraw OfficeView or UltraOffice to embbed office and give you few control against the save and edit the document. You can also send it back to server for save.

like image 54
Steve Avatar answered Dec 19 '22 02:12

Steve


There are a number of solutions to your problem, the easiest in my oppinion is a commercial app: https://crocodoc.com/. Developers have unlimited preview time but production use requires a license, don't know if thats an option in your case? To get this working in IE7 you will also need http://html5boilerplate.com/ together with http://code.google.com/p/html5shiv/.

Not sure if this solution will remain free but it is at the moment: https://cloudconvert.org/page/api. They provide an api to convert documents to html, you could write a script to convert docs to html on upload and then store html to show on site.

Another good option is http://www.phpdocx.com/ they have a conversion plugin to convert docx to HTML, pdf and such.

As for making your existing solution read only, i read somewhere you can do it with the method below but i am unable to test as i am on a mac and currently have no access to a machine with IE right now.

<object id="msword" width="100%" height="100%" classid="clsid:67F2A879-82D5-4A6D-8CC5-FFB3C114B69D" data='[insert document name].doc'>
    <PARAM NAME="src" VALUE="file:////[insert full document path here].doc" >
    <PARAM NAME="readonly" value=true>
</object>

Hope these suggestions help you with your project!

like image 26
Brian Heese Avatar answered Dec 19 '22 02:12

Brian Heese