2

I am trying to make a PowerPoint Web Add-in. I have read the Office JavaScript API documentation but it wasn't very detailed.

Do you know functions that permit to:

  • Create a new slide programmatically by an Office Add-in

  • Add text areas inside a slide programmatically by an Office Add-in.

1 Answer 1

2

It isn't possible to insert a new slide into a PowerPoint presentation at the moment. You can only navigate between existing slides using Document.goToByIdAsync().

It is possible to insert a text block or image into an existing slide however. This is done using the Document.setSelectedDataAsync() method.

For example:

function writeText() {
    Office.context.document.setSelectedDataAsync("Hello World!",
        function (asyncResult) {
            var error = asyncResult.error;
            if (asyncResult.status === Office.AsyncResultStatus.Failed) {
                console.log(error.name + ": " + error.message);
            }
        });
}

PowerPoint has been notoriously behind the other Office applications in terms of Add-in API functionality. I would highly recommending visiting the UserVoice and adding your suggestions (and voting up others). This will be super helpful when it comes to making a case for future investment into PPT API functionality.

Sign up to request clarification or add additional context in comments.

2 Comments

OK - a complementary question : if you have a template, for example with a Title, a Text area and an Image area. Is it possible today to programmatically fill them ?
I'm afraid not, there is no way to iterate through the existing objects. This is a great suggestion for the UserVoice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.