我使用以下代码以编程方式(VSTO)向PowerPoint幻灯片添加了动画
activeSlide.TimeLine.InteractiveSequences.Add().AddTriggerEffect(
textBox2,
MsoAnimEffect.msoAnimEffectFade,
MsoAnimTriggerType.msoAnimTriggerOnMediaBookmark,
selectedShape,
"Bookmark A",
MsoAnimateByLevel.msoAnimateLevelNone);
activeSlide.TimeLine.InteractiveSequences.Add().AddTriggerEffect(
textBox2,
MsoAnimEffect.msoAnimEffectFade,
MsoAnimTriggerType.msoAnimTriggerOnMediaBookmark,
selectedShape,
"Bookmark B",
MsoAnimateByLevel.msoAnimateLevelNone).Exit = MsoTriState.msoTrue;
那么如何在不删除textBox2
的情况下删除动画呢?有没有办法遍历动画并找到我需要删除的与textBox2
相关联的动画?
答案 0 :(得分:1)
原谅我,因为我没有PPT 2010方便(你应该在你的问题中注明它是那个版本),但这应该让你开始朝着正确的方向前进。
InteractiveSequences
是Sequence
个对象的集合
Sequence
对象实际上是Effect
个对象的集合
Effect
个对象具有Shape
属性
foreach (Sequence seq in activeSlide.TimeLine.InteractiveSequences)
foreach (Effect eff in seq)
if (eff.Shape == "target shape")
...
我相信效果对象本身有删除或删除功能。
答案 1 :(得分:1)
感谢Shyam Pillai的回答,我翻译了他的vba代码如下:
private void DeleteAnnimations(Slide slide, Shape shape)
{
for (int i = slide.TimeLine.InteractiveSequences.Count; i >= 1; i--)
{
Sequence sequence = slide.TimeLine.InteractiveSequences[i];
for (int x = sequence.Count; x >= 1; x--)
{
Effect effect = sequence[x];
if (effect.Timing.TriggerType == MsoAnimTriggerType.msoAnimTriggerOnMediaBookmark)
{
if (effect.Shape.Name == shape.Name)
effect.Delete();
}
}
}
}
答案 2 :(得分:0)
它只是在不删除文本框的情况下删除动画:
dim osh as shape
set osh = .....
oSh.AnimationSettings.Animate = 0 => deleting the animation of osh