简体   繁体   中英

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? )

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.

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!

I would recommend converting the file to an mht file. this will provide cleaner lines when shown in the browser and prevent the user from editing or saving the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM