【问题标题】:Embed a PowerPoint presentation into HTML with localhost使用 localhost 将 PowerPoint 演示文稿嵌入 HTML
【发布时间】:2019-11-15 20:37:42
【问题描述】:

我想用这个方法上传一个PPT演示文稿:

<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'>

这可能吗?提前谢谢你。

【问题讨论】:

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


    【解决方案1】:

    您可以使用ngrok 将本地网络服务器公开到互联网(免费版本应该足够了)。

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

    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。这假设您已经在 localhost(端口 80)中运行了一个网络服务器。

    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'>
    

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

    就是这样。这是一个示例,显示了我使用这种方法测试虚拟演示文稿时得到的结果。

    【讨论】:

      猜你喜欢
      • 2010-09-07
      • 2012-05-01
      • 1970-01-01
      • 2014-11-12
      • 1970-01-01
      • 2012-02-05
      • 1970-01-01
      • 2016-05-10
      • 1970-01-01
      相关资源
      最近更新 更多