Removing SlideMasters using the PowerPoint API

Leonardo Saturno 0 Reputation points
2024-03-11T13:28:48.5766667+00:00

Hello, I am a frontend developer for a company which uses a PowerPoint AddIn where basically are educational exercises of this platform for children and teenagers.

I need help with implementing a code for the elimination of the SlideMaster because every time new slides are loaded for a new exercise (it is not necessary to load another powerpoint document) these SlideMaster are being added and then interfere in exercises (especially those with general styles for normal slides).

I have been consulting this part of the API documentation: https://learn.microsoft.com/en-us/javascript/api/powerpoint/powerpoint.slidemastercollection?view=powerpoint-js-1.5; But I have only managed to get information by importing information such as: iterate over the number of SlideMasters or get their IDS; but it does not help me much since there is no method or function that is "delete" so that I can implement in the code so that every time they load new Slides per exercise, all the SlideMasters are deleted until only 1 is left (for example).

Thanks in advance for the answer and help.

PowerPoint
PowerPoint
A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.
227 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,566 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Claudia Dos Santos Haz (CONCENTRIX CORPORATION) 775 Reputation points Microsoft Vendor
    2024-03-12T14:28:44.8533333+00:00

    Hello @Leonardo Saturno,

     

    Thank you for reaching out to Microsoft Q&A forum!

     

     

    To treat cases like PowerPoint API, first of all you can try this article:

     

     Add and delete slides in PowerPoint - Office Add-ins | Microsoft Learn

     

    User's image

     

    If this does not solve your problem, please ask a new question using the Microsoft Graph Q&A.

     

    Go to:

    https://aka.ms/AskGraph 

     

    And ask your question again to get help.

     

    Best regards,

    0 comments No comments

  2. John Korchok 5,101 Reputation points
    2024-03-12T15:56:05.59+00:00

    You'll get better information with the correct terms. A default Microsoft presentation has 1 Slide Master and 11 Slide Layouts. In Slide Master view, the slide master is the larger thumbnail at the top of the list of thumbnails, while the slide layouts are the smaller thumbnails below.

    If a slide is based on a slide layout, you cannot remove that layout. You can only remove unused layouts.

    It's best and easiest to design a slide template that includes only the needed slide layouts, then distribute that to all users. You may be able to do this with a GPO.