none
PowerPoint: Howto access slide master shapes in presentations RRS feed

  • Question

  • Hi there,

    I'm really getting mad and I hope someone can help me with an issue I'm facing now for a few days already:

    I'm trying to find a way to set data programatically to a placeholder in custom layout slides. Later I'd like to get this data by going to the actual slide and check for the placeholder that was used.

    Problem is, I can't find a way how to solve this. I've tried it with the values of the shapes/placeholders inside a custom layout. Than I tried to set tags. But whatever I do I stuck on the situation that (at least it seems so) there is no way to get the placeholder from custom layout, that was used to create the shape inside a slide.

    Sorry if I shouldn't be clear enough (sitting for 96 hours on this now), but please ask if something shouldn't be clear.

    So my question is: How or where inside the available objects/classes can I find the part about if and what placeholder was used for a shape in a slide so I can get the data set for the placeholder into the shape on the slide?

    Many thanks in advance for anyone who could point me in the right direction as I'm really getting under heavy time issues :(

    Regards,
    Thomas


    • Edited by Tom_O Thursday, April 4, 2013 9:18 AM Changed the title to a more meaningful one.
    • Moved by Cindy Meister MVPModerator Thursday, April 4, 2013 9:27 AM not using VSTO technology
    Monday, April 1, 2013 8:55 PM

Answers

  • One day later, but here's the solution for those facing the same issue:

    Requirement: Texts shown in new and current slides in a presentation should be replaced programmatically at runtime. Let's call them "Insert Tags" for now. These Insert Tags should be set in slide master in each custom layout.

    Issue: You cannot use placeholders for this, because you're able to get the placeholder content, but there's no reliable reference from shapes in a slide to their equivalent shapes in slide master.

    Solution: Simple if you know it: Use text fields instead of placeholders in slide master custom layouts. Than you can take the current slide and access its referenced custom layout, where you iterate through the shapes (here you get the text fields).

    Slide.CustomLayout.Shapes

    If you have added such text fields in the master custom layout, instead of individual custom layouts, be aware that you cannot access them as shown above. Here you need to iterate through:

    Slide.Master.Shapes

    Now you can check each individual shape for its content and replace it with whatever you might need.

    Happy coding
    Thomas


    • Edited by Tom_O Thursday, April 4, 2013 9:15 AM
    • Marked as answer by Tom_O Thursday, April 4, 2013 9:16 AM
    Thursday, April 4, 2013 9:15 AM

All replies

  • UPDATE:

    Now I thought I try another way as I not necessarily need to use placeholders for my solution.

    So I've added text fields onto custom layout in master view and replaced the placeholders with them. So at least the text was visible on a new slide and I might just need to read out these texts programmatically and do something with it.

    But now I've noticed that not even this is working. Even if I check Slide.Master.Shapes instead of Slide.Shapes I cannot find my elements there and therefor cannot access their text values.

    Please, someone must know what shape or placeholder or custom layout values can be used between a custom layout and the actual slide!?

    Regards,
    Thomas

    Tuesday, April 2, 2013 12:17 PM
  • Hi Thomas

    This isn't really VSTO-related, more PowerPoint. And the best place to get help with it would probably be the forum where the PPT specialists hang out, which isn't on MSDN, but "Answers":

    http://answers.microsoft.com/en-us/office/forum/powerpoint?tm=1364915783635

    Even the devs tend to congregate in that forum - nice bunch of folks, say "Hi" for me :-)

    When you post, be sure to mention which version of PPT you're struggling with as that can affect what's available to you, or how PPT behaves.

    The only thing I can offer would be - if you don't need to be working with this information inside the PPT application - to consider "peeking" at the Open XML file format (assuming this is pptx, not the old ppt).

    Unfortunately, it's not possible to move discussions from MSDN to Answers, so you will need to ask there again. And I should move this discussion to "General Office Development" as it does not seem to involve working with the VSTO technology, just the PPT APIs...


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, April 2, 2013 3:21 PM
    Moderator
  • Hi Cindy,

    Thanks for replying!

    Your absolutely right, this is the wrong forum. But meanwhile I also found a solution and therfore don't need the other forum anymore.

    I'd really appreciate the movement as I will add the solution tomorrow, just in case anyone will face the same issue. Because I've needed 3 days to find the solution.

    Only thing I'd ask you for is not moving the thread until I've added the solution. As you might imagine my time's short at the moment because of hanging 3 days on that issue and so I don't need to search for it ;)

    Regards,
    Thomas

    Tuesday, April 2, 2013 10:20 PM
  • One day later, but here's the solution for those facing the same issue:

    Requirement: Texts shown in new and current slides in a presentation should be replaced programmatically at runtime. Let's call them "Insert Tags" for now. These Insert Tags should be set in slide master in each custom layout.

    Issue: You cannot use placeholders for this, because you're able to get the placeholder content, but there's no reliable reference from shapes in a slide to their equivalent shapes in slide master.

    Solution: Simple if you know it: Use text fields instead of placeholders in slide master custom layouts. Than you can take the current slide and access its referenced custom layout, where you iterate through the shapes (here you get the text fields).

    Slide.CustomLayout.Shapes

    If you have added such text fields in the master custom layout, instead of individual custom layouts, be aware that you cannot access them as shown above. Here you need to iterate through:

    Slide.Master.Shapes

    Now you can check each individual shape for its content and replace it with whatever you might need.

    Happy coding
    Thomas


    • Edited by Tom_O Thursday, April 4, 2013 9:15 AM
    • Marked as answer by Tom_O Thursday, April 4, 2013 9:16 AM
    Thursday, April 4, 2013 9:15 AM