Search code examples
powerpointoffice-jsoffice-addinspowerpoint-addinspowerpoint-web-addins

PowerPoint Add-In add html iFrame to slide


I want to create an Add-In where I can set an URL via textbox and by clicking the apply button the iframe gets added to a new slide at the end of the presentation. I could add an iFrame with content app but unfortunatelly it is not working with saving the powerpoint.

I know how to add the slide and also simple text boxes or shapes on it but how can I add an iFrame?

Here's the code snippet where I would like to add an iframe to the slide. I've tried it with shapes without success and I have no idea how to continue...

async function addIFrameToSlide(slideIndex) {        
        const iframe = getIFrame();

        await PowerPoint.run(async function(context) {
            const shapes = context.presentation.slides.getItemAt(slideIndex).shapes;
            
            
            await context.sync();
        });       


    }

Solution

  • The Office JavaScript API doesn't provide anything for embedding iframes out of the box. But you may consider developing Content Office Add-ins instead.

    Content add-ins are surfaces that can be embedded directly into Excel or PowerPoint documents. Content add-ins give users access to interface controls that run code to modify documents or display data from a data source. Use content add-ins when you want to embed functionality directly into the document.

    Note, you can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.