none
how to set powerpoint animations to OLE objects in powerpoint (C#)? RRS feed

  • Question

  • I want to add a few animations to my OLE objects in PPTX, but the number is huge.

    So I would like to do this in C#.

    I opened my pptx and find my sharps aready!

    var app = new PPT.Application(); 
    
    var pptPre = app.Presentations.Open(...);
    
    var sharp1 = pptFstSlide.Shapes.AddOLEObject(...);


    To the OLE object(sharp1)  I want to First add "entrance"---"Flash once" animation , started with Previous.

    then I want to add  "object actions"---"Active Contents" ,started with after Previous.

    Do anyone know how to do this in C#?

    Thanks

    Jack


    Monday, October 27, 2014 7:35 AM

All replies

  • I added this:

                PPT.Sequence pSequence_01 = pptFstSlide.TimeLine.InteractiveSequences.Add(1);
                PPT.Effect pEffect = pSequence_01.AddEffect(sharp1, PPT.MsoAnimEffect.msoAnimEffectFlashOnce, PPT.MsoAnimateByLevel.msoAnimateLevelNone, PPT.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                pEffect.Exit = Microsoft.Office.Core.MsoTriState.msoFalse;

    Error occurs:

    System.Runtime.InteropServices.COMException (0x80048240): Sequence.AddEffect : Invalid request. 

    maybe there is some other ways to send COmmandEffect?

    Monday, October 27, 2014 8:56 AM
  • I have successfully add a "entrance"---"Flash once" animation by using the function "AddEffect",

    but I still cannot add the "object actions"---"Active Contents" animation.

    the "AddEffect" Function does not have this type in its second parameter.

    http://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.powerpoint.msoanimeffect%28v=office.14%29.aspx

    Tuesday, October 28, 2014 2:06 AM
  • Hi Blursight,

    Thanks for posting in MSDN forum.

    >>I have successfully add a "entrance"---"Flash once" animation by using the function "AddEffect",

    but I still cannot add the "object actions"---"Active Contents" animation.<<

    What did you mean "Active Contents" animation? As far as I know, there are four kinds of animation type in PowerPoint, Entrance, Emphsis, Exit, Motion Paths.

    Did it mean you want to actve the Ole Object? If I understood exactly, we can use OLEFormat.Activate to active the specific object.

    If I misunderstood, pelase feel free to let me know.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 29, 2014 6:47 AM
    Moderator