有没有办法使用 office web 查看器在本地查看 word 文件 [英] Is there a way to view word files locally using office web viewer

查看:49
本文介绍了有没有办法使用 office web 查看器在本地查看 word 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 word 文件,我想打开该 word 文件仅用于预览/查看目的,而不是进行编辑.我怎么能这样呢?

我有一个 Django 应用程序,该应用程序的主要目的之一是查看人们在网站上上传的文档.但是,出于测试目的,由于我不知道的原因,我无法预览文档.

我正在使用

我假设办公室查看者期待的是一个真实的"互联网目录,而不是本地目录.

解决方案

解决方案很简单.

要从 Office Viewer 之类的工具打开文件,该文件必须可以从 Internet 上的任何位置访问.127.0.0.1"是你的本地环回地址,只能从你的电脑访问,所以Office查看器无法访问.

即使在测试环境中,您也需要将媒体文件上传到公共存储并使其可从 Internet 访问.

将您的 Django 应用程序部署到公共托管实例,或使用 Django-Storage 应用程序从公共存储服务(例如 AWS S3)提供媒体文件.

I have a word file, and I want to open up that word file for preview/viewing purposes only, not to edit. How could I go by this?

I have a Django application and one of the main purpose of the application is to view documents that people upload on the site. However for testing purposes I cannot get to preview documents for reasons I do not know.

I am using Microsoft office viewer to view the files.

This is my html code in Django:

<iframe
src="https://view.officeapps.live.com/op/embed.aspx?src=http://127.0.0.1:8000/media/project/1/f73ab109-dcaa-4cc3-bbfc-7121eca10118.doc">
</iframe>

And of course media/project/1/f73ab109-dcaa-4cc3-bbfc-7121eca10118.doc is the location of the file. The error displayed in the html:

I am assuming that the office viewer is expecting a "real" internet directory and not something locally.

解决方案

The solution is simple.

To open a file from something like Office Viewer, the file must be accessible from anywhere on the Internet. "127.0.0.1" is your local loopback address, which is accessible only from your computer, so the Office Viewer can not access.

Even in a test environment, you will need to upload the media file to public storage and make it accessible from the Internet.

Deploy your Django App to a publicly hosted instance, or use Django-Storage app to serve MEDIA files from a public storage service such as AWS S3.

这篇关于有没有办法使用 office web 查看器在本地查看 word 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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