none
How to change Master of a slide?? RRS feed

  • Question

  • Hello,

    I'm trying copy a slide from a presentation to other by using vsto and C#. (I'm using PowerPoint 2010). I used the command:

          desPresentation.Slides.InsertFromFile(folderPath + sourcePre, index, 3, 3);//copy 3rd slide from source presentation

    After that, this copied slide will be applied the SlideMaster of the destination slide. But i want to keep the old Master of this slide (keep the source formatting). So how can i do??

    Thanks in advance.


    Friday, July 22, 2011 12:50 PM

Answers

  • Hi all,

    I have found a solution for this problem. I'm using Office 2010. For Keeping the source formatting when copying a specific slide, here is my code:

                          srcPresentation.Slides[index1].Copy(); // Copy the slide which you want

                          desPresentation.Slides[index2].Select(); // In order to determine where you want copy the slide to in destination presentation

                         desPresentation.Application.CommandBars.ExecuteMso("PasteSourceFormatting");

                         desPresentation.Save();

     

    Thanks for your following this thread.

    • Marked as answer by biennl86 Tuesday, July 26, 2011 9:32 AM
    Tuesday, July 26, 2011 9:32 AM

All replies

  • It might be best to ask this of the application specialists on "Answers". They don't venture into the MSDN forums, I'm afraid.

    Just ask them how they'd do it programmatically and don't worry about the programming language (probably VBA) they provide. Once you know which parts of the object model you need, you can implement it in C# (and if you can't find it we can help you, once we know the basic "how").

    http://answers.microsoft.com/en-us/office/forum/powerpoint


    Cindy Meister, VSTO/Word MVP
    Friday, July 22, 2011 1:25 PM
    Moderator
  • Hi Cindy. I know, I posted one question in that site 3 weeks ago but there isn't any reply for now.

    Otherwise, it's impossible to assign Master object of a slide or a presentation because it's read-only. I want to do eactly the same way when I choose function "reuse slides..." with keep source formatting option in the PoewerPoint application.

    Thanks.

    Friday, July 22, 2011 1:48 PM
  • Hi all,

    I have found a solution for this problem. I'm using Office 2010. For Keeping the source formatting when copying a specific slide, here is my code:

                          srcPresentation.Slides[index1].Copy(); // Copy the slide which you want

                          desPresentation.Slides[index2].Select(); // In order to determine where you want copy the slide to in destination presentation

                         desPresentation.Application.CommandBars.ExecuteMso("PasteSourceFormatting");

                         desPresentation.Save();

     

    Thanks for your following this thread.

    • Marked as answer by biennl86 Tuesday, July 26, 2011 9:32 AM
    Tuesday, July 26, 2011 9:32 AM
  • Glad you found a solution, and thank you very much for posting it here where others can benefit :-)
    Cindy Meister, VSTO/Word MVP
    Tuesday, July 26, 2011 9:36 AM
    Moderator