使用localhost将PowerPoint演示文稿嵌入HTML

时间:2019-07-05 08:17:50

标签: html iframe office365 powerpoint office-online-server

我想使用此方法上传PowerPoint演示文稿:

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[https://www.your_website/file_name.pptx]' width='100%' height='600px' frameborder='0'>

但是我正在使用XAMMP来使用localhost服务器,所以我需要这样的东西

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

这可能吗?预先谢谢你。

1 个答案:

答案 0 :(得分:1)

您可以使用ngrok将本地Web服务器公开到Internet(免费版本就足够了)。

这些是我在本地主机中运行此操作所遵循的操作。我用一个虚拟演示文稿对其进行了测试。

1。创建一个ngrok帐户

转到ngrok网站并创建一个免费帐户。然后,获取您的身份验证令牌。

2。在计算机上安装ngrok

在命令行中运行以下命令(使用WLS的Linux或Windows):

sudo apt-get install ngrok-client
ngrok authtoken [enter_your_authtoken_here]
ngrok http 80

最后一个命令会将本地Web服务器公开到公共URL。假定您已经在本地主机(端口80)中运行Web服务器。

3。准备嵌入代码

使用嵌入代码保存.html文件,替换src属性以包括ngrok提供的新URL。确保您的file_name.pptx也可以在localhost中访问。

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[https://www.your_website/file_name.pptx]' width='100%' height='600px' frameborder='0'>

用ngrok生成的URL相应地替换https://www.your_website。 (您可以从命令行获取公开的URL,请参见下图)。

Example: Shows ngrok running in the console

仅此而已。这是一个示例,显示了使用这种方法测试虚拟演示文稿时获得的结果。

enter image description here

相关问题