none
Intercept copy/paste of slide in PPT addin, and get the slide data from Clipboard. RRS feed

  • Question

  •                         if (Functions.IsKeyDown(Keys.ControlKey) && keyData == Keys.C && KeyWasAlreadyPressed == false)
                            {
                                selectionType = Globals.ThisAddIn.Application.ActiveWindow.Selection.Type;
                            }

                            if (Functions.IsKeyDown(Keys.ControlKey) && keyData == Keys.V && KeyWasAlreadyPressed == false)
                            {
                                if (selectionType == PpSelectionType.ppSelectionSlides)
                                {
                                  //  var x = obj.GetData("PowerPoint 12.0 Internal Slides");

                                  //  Slide slide = (Slide)obj.GetData("PowerPoint 12.0 Internal Slides");

                                    Globals.ThisAddIn.OnSlidePaste();
                                }
                            }

    There is a lot of code that I omitted when it comes to intercepting keys, but this ctrl+c, ctrl+v functionality works.

    What I want is to get the new Powerpoint Slide object from Clipboard. OnSlidePaste gets called, however, slide is not yet pasted and I have no easy way to get Slide object there.

    obj.GetData("PowerPoint 12.0 Internal Slides") returns a memory stream. Can it be used to read the slide data and convert it to a Slide object?

    Tuesday, April 23, 2019 6:27 AM