在powerpoint滑块中嵌入HTML - Javascript。 [英] Embed HTML - Javascript in a powerpoint slider.

查看:111
本文介绍了在powerpoint滑块中嵌入HTML - Javascript。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

Hello to all.

由于我的工作,我需要在我的powerpoint幻灯片中包含交互性。这种交互性是用javascript和html完成的。 ( P5.js )。我需要的是将html
嵌入到幻灯片中,而不是作为浏览器的链接。

Due to my work, I need to include interactivity in my powerpoint slides. This interactivity is made in javascript and html. (P5.js). What I need is to have the html embed in the slide and NOT as a link to the browser.

我想知道是否有人可以指出我从哪里开始在C#。

I am wondering if anyone could point me where to start in C#.

任何线索都将非常受欢迎。

any clue will be very appreciated.




提前谢谢,

thanks in advance,

Carlos。

推荐答案

Hello Carlos,

Hello Carlos,

您可以使用C#创建VSTO加载项并添加Web浏览器控件以显示html并运行脚本。

You may use C# to create VSTO add-ins and add a web browser control to display the html and run scripts.

要创建VSTO加载项,请从
Office解决方案开发概述(VSTO)

To create VSTO add-ins, please get started from Office Solutions Development Overview (VSTO)

要使用Web浏览器控件,请访问
无法将某些可编写脚本的ActiveX控件插入Office 2013文档
。您将收到错误"无法插入此ActiveX控件"插入Web浏览器控件时。这是设计的,但您可以在上面的文章
中获得解决方法。

To use Web browser control, please visit Cannot insert certain scriptable ActiveX controls into Office 2013 documents. You would get error "This ActiveX control cannot be inserted" when inserting Web browser controls. This is by design, but you could get the workaround in the article above.

然后您可以参考以下代码添加Web浏览器控件和命令按钮以进行导航和运行脚本。

Then you could refer to the following code to add web browser control and command buttons to navigate and run scripts.

using SHDocVw; // add reference Microsoft Internet Controls
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using MSForms = Microsoft.Vbe.Interop.Forms;

    IWebBrowser2 webb;
        private void addWebBrowser_Click(object sender, RibbonControlEventArgs e)
        {
            PowerPoint.Slide slide = Globals.ThisAddIn.Application.ActivePresentation.Slides.Add(Globals.ThisAddIn.Application.ActivePresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutBlank);
                       
            PowerPoint.Shape web= slide.Shapes.AddOLEObject(50, 50, 250, 250, "Shell.Explorer.2");
            webb = web.OLEFormat.Object as IWebBrowser2;
        
            PowerPoint.Shape button1 = slide.Shapes.AddOLEObject(50, 320, 80, 30, "Forms.CommandButton.1");
            MSForms.CommandButton CmdBtn1 = button1.OLEFormat.Object as MSForms.CommandButton;
            CmdBtn1.Caption = "Navigate";
            CmdBtn1.Click += CmdBtn1_Click;

            PowerPoint.Shape button2 = slide.Shapes.AddOLEObject(150, 320, 80, 30, "Forms.CommandButton.1");
            MSForms.CommandButton CmdBtn2 = button2.OLEFormat.Object as MSForms.CommandButton;
            CmdBtn2.Caption = "Run Script";
            CmdBtn2.Click += CmdBtn2_Click;
        }

        private void CmdBtn1_Click()
        {
            webb.Navigate2("http://localhost:4330/Welcome");
            webb.Silent = true;
        }

        private void CmdBtn2_Click()
        {
            webb.Document.parentWindow.execScript("test()");
        }

如果您熟悉JavaScript,我建议您使用Office JavaScript API开发Office加载项以进行交互Office客户和文档。

If you are familiar with JavaScript, I also suggest you develop Office add-ins using Office JavaScript API to interact with Office clients and documents.

请访问
Office加载项平台概述
&&
PowerPoint加载项

Please visit Office Add-ins platform overview & PowerPoint add-ins

问候,

Celeste


这篇关于在powerpoint滑块中嵌入HTML - Javascript。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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