简体   繁体   中英

How to add a default sound in MS PowerPoint to a shape in a slide using c#

Here is my code:

Microsoft.Office.Interop.PowerPoint.Shape rectangle = curSlide.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeRoundedRectangle, slideWidth - 110, slideHeight - 60, 100, 50);
Sequence objSequence = curSlide.TimeLine.InteractiveSequences.Add(1);
Effect pEffect_start = objSequence.AddEffect(rectangle, MsoAnimEffect.msoAnimEffectTransparency, MsoAnimateByLevel.msoAnimateLevelNone, MsoAnimTriggerType.msoAnimTriggerOnShapeClick, 1);

I can add an animation to shape, but with a sound I can not.

I do not want to add file in a location:

rectangle.AnimationSettings.SoundEffect.ImportFromFile(fileLocation);

I want to add default sounds in Powerpoint:

Powerpoint对象听起来纠察

How can I do that?

let you try to add this line of code after yours

pEffect_start.EffectInformation.PlaySettings.PlayOnEntry = Office.MsoTriState.msoCTrue;

The PlayOnEntry means the media is played/ not played on load event. This property is supported even before MS Powerpoint 2007

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM