How to Get Shape object(Powerpoint) by its Id/Name in c# using Office Primary Interop Assemblies RRS feed

  • Question

  • Hi,

    I have extracted Shape Ids from power point presentation using Open XML, I want to get COM object  against those ids using primary interop assemblies. can any one help?

    Eventual goal will be triggering Action using Shape.ActionSetting .


    Wednesday, September 6, 2017 6:24 PM

All replies

  • Hi kkhanzada,

    You could iterate through shapes and compare their Shape.ID with the id you got.

    However, please note that, shapes in different slide could have the same shape id.

    Here is the example to iterate through all the slides and return after finding first shape which meets the id.

                long id = 5;
                foreach (PPT.Slide slide in activePresentation.Slides) {
                    foreach(PPT.Shape shape in slide.Shapes)
                        if (shape.Id == id) {
                            //set ActionSetting for your need
                            //here is the example to  reutrn to first slide when the mouse is over the shape
                            shape.ActionSettings[PPT.PpMouseActivation.ppMouseOver].Action = PPT.PpActionType.ppActionFirstSlide;

    Best Regards,


    Thursday, September 7, 2017 6:27 AM