locked
c# with PowerPoint Slide RRS feed

  • Question

  • Hello,

    How can I add a command button to a PowerPoint Slide? Please help me.

    Regards,
    br
    Wednesday, April 22, 2009 9:51 AM

Answers

All replies

  • Hi,

    You might want to create office add-in:
    http://support.microsoft.com/kb/302901.

    Harry
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, April 24, 2009 8:27 AM
  • Hi Harry,

    Thanks for the reply.

    This helped me how to create Commandbar and CommandbatButtons. Now I added a Shape(msoShapeActionButtonCustom) to the PowerPoint Slide. How can I define or listen the actions or events for the created shape. Please help me.

    Regards,
    br
    Friday, April 24, 2009 10:20 AM
  • Hi,

    You might want to take a look at the article which illustrates how to handle command bar event :
    http://support.microsoft.com/kb/303018

    Hope it will help,
    Harry
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, April 27, 2009 5:38 AM
  • Hi Harry,

    Thanks for the reply. The articles are very good, but they are talking much about the commandbar and commandbar buttons. I would like to know how to handle the events for "Shape on the Slide". Here is my code,

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using PowerPoint = Microsoft.Office.Interop.PowerPoint;
    using Office = Microsoft.Office.Core;

    namespace AddTextAddin
    {
        public partial class ThisAddIn
        {
           
            void Application_PresentationNewSlide(PowerPoint.Slide Sld)
            {
               PowerPoint.Shape textBox = Sld.Shapes.AddTextbox(
                    Office.MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 500, 50);
                textBox.TextFrame.TextRange.InsertAfter("is text was added by using code.");
               
               
                PowerPoint.Shape pt = Sld.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeActionButtonCustom, 100, 100, 100, 100);
                pt.TextFrame.TextRange.InsertAfter("Voting");
               
            }
           

            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                this.Application.PresentationNewSlide +=
        new PowerPoint.EApplication_PresentationNewSlideEventHandler(
        Application_PresentationNewSlide);
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }

            #region VSTO generated code

            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
           
            #endregion
        }
    }

    In the above code I have generated a Shape "pt" on the Slide, now I would like to handle the events for that shape. How can I handle the events for the shapes. Please help me.

    Regards,
    br
    Monday, April 27, 2009 9:43 AM
  • Hi,

    As far as I know , the events of shapes are not supported.

    You might want to post to the newsgroup to see if these events can be used:
    http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.powerpoint&cat=en_US_884a862c-d238-4f41-a3ea-5c77639600cf&lang=en&cr=US

    Harry


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Harry Zhu Wednesday, April 29, 2009 8:34 AM
    Tuesday, April 28, 2009 9:41 AM