前端在线预览excel、word、pdf、ppt

这里主要推荐两种官方提供的API.

第一是微软提供API,调用方法如下,支持('.ppt''.pptx''.doc','.docx','.xls','.xlsx')格式。

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

第二种是谷歌提供的API

Google文档提供了一个未记录的功能,可让您将PDF文件和PowerPoint演示文稿嵌入到网页中。这些文件不必上传到Google文档,但需要在线提供。

Google Drive Viewer:显式PDF文件

<iframe src="https://docs.google.com/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
<iframe src="https://drive.google.com/viewerng/viewer?url=http://docs.google.com/fileview?id=0B5ImRpiNhCfGZDVhMGEyYmUtZTdmMy00YWEyLWEyMTQtN2E2YzM3MDg3MTZh&hl=en&pid=explorer&efh=false&a=v&chrome=false&embedded=true" frameborder="0"></iframe>

猜你喜欢

转载自blog.csdn.net/zhuoganliwanjin/article/details/105676608