How to apply PowerPoint template (POTX/PPTX) to existing slides using Office.js without replacing content?

Umair Shehzad 0 Reputation points
2025-10-08T14:53:54.57+00:00

Hi team,

I’m developing a PowerPoint Add-in (taskpane app) using the Office.js PowerPoint JavaScript API.

My goal is to allow users to apply uploaded PowerPoint templates (PPTX or POTX) from our backend to their currently open presentation — ideally applying the theme, colors, and layout to existing slides without inserting or replacing content.

Here’s the behavior I’m currently seeing:

  • I’m using PowerPoint.run() with presentation.insertSlidesFromBase64().

This successfully inserts the new template slides.

However, it adds new slides instead of applying the design or layout to existing ones.

I even tried copying slide content after insertion, but the API doesn’t seem to allow reading/writing slide shapes or design metadata at this level.

I’ve reviewed the PowerPoint JavaScript API documentation, but I haven’t found any method to:

Apply a .potx design/theme to an existing slide.

Copy slide content into another slide programmatically.

Modify the master theme or layout through Office.js.


Questions

Is there currently any way (even indirect) to apply a theme/template to existing slides via Office.js?

Can we read or duplicate existing slide content (shapes, text, media) to a new slide?

Are there any roadmap plans or preview APIs that will support these operations in the future?

If this is a known limitation, what’s the best possible workaround for preserving user slide content while applying a new design?


Context

We’re building an AI-powered PowerPoint Add-in that:

Fetches templates from an admin backend (stored on S3)

Lets users apply templates directly within PowerPoint

Intends to enhance slides with AI-generated titles and designs

We currently can: ✅ Upload and fetch templates ✅ Insert templates as new slides 🚫 Cannot apply template to existing slides without replacing content

Any guidance, recommended patterns, or future API updates would be really helpful.

Thank you!

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Teddie-D 7,095 Reputation points Microsoft External Staff Moderator
    2025-10-09T01:00:31.5066667+00:00

    Hi @Umair Shehzad 

    Thank you for posting your question in the Microsoft Q&A forum. 
    Currently, the PowerPoint API in Office.js does not support applying a new theme or master layout to existing slides. There’s no access to the slide master or theme engine, so you cannot programmatically reapply or switch templates once slides are created. 

    Additionally, Office.js doesn’t provide a way to read all shapes from a slide and re-render them on another. This limitation has been discussed in several community threads. A few related discussions you might find helpful: 
    How to duplicate a slide or copy a PowerPoint shape from one slide to another using the PowerPoint … 
    office365 - Copy PowerPoint shapes using office js to a new slide - Stack Overflow 
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.  

    At this time, there’s no public roadmap confirming when or if the PowerPoint API will include features such as applying a theme to existing slides or cloning shapes. You can follow updates via the Microsoft 365 Developer Blog

    In the meantime, here are a few workarounds you might consider: 

    1. Insert template slides and migrate content manually 
    -Insert slides from the template using insertSlidesFromBase64()
    You can refer to office-js-docs-pr/docs/powerpoint/insert-slides-into-presentation.md at main · OfficeDev/office-js-… 
    -Prompt the user to manually copy content into the new slides or use PowerPoint’s built-in Reuse Slides feature. 

    2.You can still insert at least one slide from the uploaded .potx or .pptx file to ensure the theme becomes available in PowerPoint’s theme gallery. After inserting the template slides, instruct users to manually apply the theme via Design > Themes. You can support this by providing UI guidance in your taskpane. 

    3.Use insertSlidesFromBase64() to add a few slides from the uploaded .potx file. This brings the theme and layouts into PowerPoint. Then, provide a clear flow for users to manually copy their content into the new slides. 

    I hope this helps clarify the current limitations and possible approaches. Please let us know if you have further questions. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.