Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

Looking for a PowerPoint event that can detect any edits or modifications done on a Slide.

$
0
0

I have written a C# WPF desktop application that uses the Microsoft PowerPoint 15.0 Object Library, and I want to be able to detect when any Slide is edited or modified.  I was able to find a few events that I can latch onto, but it doesn't detect any pen tool annotations on the slide.  So I guess my question is really two questions:

  1. Is there a PowerPoint API event that encompasses any and all Slide edits/modifications?
  2. Is there an event that can detect Pen ink strokes were added?

Here is a snippet of what I am able to do so far:

        public void Initialize()
        {
            LogManager.Log();

            // Create an instance of PowerPoint.
            this.powerpointApp = new Microsoft.Office.Interop.PowerPoint.Application();

            // USED
            this.powerpointApp.WindowSelectionChange += this.WindowSelectionChange;
            this.powerpointApp.AfterPresentationOpen += this.AfterPresentationOpen;
            this.powerpointApp.SlideSelectionChanged += this.SlideSelectionChanged;
            this.powerpointApp.SlideShowNextSlide += this.SlideShowNextSlide;
            this.powerpointApp.PresentationNewSlide += this.PresentationNewSlide;
            this.powerpointApp.WindowActivate += this.WindowActivate;
            this.powerpointApp.AfterShapeSizeChange += this.AfterShapeSizeChange;
        }

        [DispId(2001)]
        private void WindowSelectionChange(Microsoft.Office.Interop.PowerPoint.Selection sel)
        {
            if (sel.Type == PpSelectionType.ppSelectionShapes || sel.Type == PpSelectionType.ppSelectionText)
            {
                // This condition means that you selected text or a shape within a slide.  This can happen even when you write or create a new object
                // onto the slide.
                LogManager.Log(string.Format("sel is {0}", sel.GetType()));
            }
            else
            {
                LogManager.Log(string.Format("sel is {0}", sel.GetType()));
            }

            var displayText = sel.Type.ToString();
            LogManager.Log(string.Format("PPT:{0}: sel.Type:{1}", System.Reflection.MethodBase.GetCurrentMethod().Name, displayText));
        }

        private void AfterShapeSizeChange(Microsoft.Office.Interop.PowerPoint.Shape shp)
        {
            var slide = this.powerpointApp.ActivePresentation.Slides[1];
            LogManager.Log(string.Format("PPT:AfterShapeSizeChange(...): SlideID:{0},Pres:{1}", slide.SlideID, slide.Application.ActivePresentation.Name));

            this.refreshFilter.QueueRequest(slide);
        }


Any help would be greatly appreciated!

Tam Bui


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>