使嵌入网页的Word文档可编辑或只读
我使用 iframe 将一些 Word 文档嵌入到我们的网页中,如下所示:
<iframe src="ftp://ftp.example.com/www/uploads/Image/test.doc" width="100%" height="400">
Alternative
</iframe>
问题是嵌入的 Word 控件允许用户编辑文档并显示一个图标来保存它们,但不实际上保存任何东西。 是否可以设置 Word 将编辑内容保存回 FTP 服务器? 如果没有,我们是否可以通过某种方式将文档设为只读,这样用户就不会知道他们可以进行更改? 我们使用的是 IE7 和 Word 2003。
(我刚刚问了一个有关将 Word 保存到 FTP 服务器的相关问题:Word 可以在没有 Sharepoint 的情况下直接从 Web 服务器编辑文档吗?)
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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 EDraw OfficeView 或 UltraOffice 等 ActiveX 组件来嵌入 Office,并为您提供对保存和编辑文档的少量控制。 您也可以将其发送回服务器进行保存。
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.
您的问题有多种解决方案,我认为最简单的是商业应用程序: https://crocodoc.com/。 开发人员有无限的预览时间,但生产使用需要许可证,不知道您是否可以选择? 要在 IE7 中使用此功能,您还需要 http://html5boilerplate.com/ 以及 http://code.google.com/p/html5shiv/。
不确定此解决方案是否会保持免费,但目前是:https://cloudconvert.org/page/api< /a>. 他们提供了一个将文档转换为 html 的 api,您可以编写一个脚本在上传时将文档转换为 html,然后存储 html 以在网站上显示。
另一个不错的选择是 http://www.phpdocx.com/ 他们有一个转换插件可以将 docx 转换为 HTML 、pdf 等。
至于让你现有的解决方案只读,我在某处读到你可以用下面的方法来做到这一点,但我无法测试,因为我在 Mac 上,并且目前无法访问带有 IE 的计算机。
希望这些建议对您的项目有所帮助!
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.
Hope these suggestions help you with your project!
我建议将文件转换为 mht 文件。 这将在浏览器中显示时提供更清晰的线条,并防止用户编辑或保存文件。
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.