使嵌入在网页中的 Word 文档可编辑或只读 [英] Making Word document embedded in a web page editable or read-only

查看:30
本文介绍了使嵌入在网页中的 Word 文档可编辑或只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 iframe 将一些 Word 文档嵌入到我们的网页中,如下所示:

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>

问题在于嵌入的 Word 控件允许用户编辑文档并显示一个图标来保存它们,但实际上并没有保存任何内容.是否可以设置 Word 将编辑保存回 FTP 服务器?如果没有,有什么办法可以使文档只读,这样用户就不会知道他们可以进行更改吗?我们使用的是 IE7 和 Word 2003.

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.

(我刚刚问了一个关于让 Word 保存到 FTP 服务器的相关问题:Word 是否可以在没有 Sharepoint 的情况下直接从 Web 服务器编辑文档?)

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

推荐答案

有多种解决方案可以解决您的问题,我认为最简单的是商业应用程序:https://crocodoc.com/.开发人员有无限的预览时间,但生产使用需要许可证,不知道这是否适合您的情况?要在 IE7 中使用它,您还需要 http://html5boilerplate.com/http://code.google.com/p/html5shiv/.

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/.

不确定此解决方案是否会保持免费,但目前是免费的:https://cloudconvert.org/page/api.他们提供了一个 api 来将文档转换为 html,您可以编写一个脚本来在上传时将文档转换为 html,然后存储 html 以在网站上显示.

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.

另一个不错的选择是 http://www.phpdocx.com/ 他们有一个转换插件来转换docx 到 HTML、pdf 等.

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

至于使您现有的解决方案只读,我在某处阅读了您可以使用以下方法执行的操作,但我无法进行测试,因为我在 mac 上并且目前无法访问带有 IE 的机器.

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!

这篇关于使嵌入在网页中的 Word 文档可编辑或只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆