翻譯|使用教程|編輯:李顯亮|2021-08-23 10:04:59.360|閱讀 286 次
概述:我們可以將動畫效果應用于文本、形狀和幻燈片。在本文中,您將學習如何使用 C# 將動畫應用于 PowerPoint 中的文本。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
PowerPoint 演示文稿中的動畫文本用于吸引觀眾的注意力。此外,它還使演示文稿的內容栩栩如生??梢詫赢嬓Ч麘糜谖谋尽⑿螤詈突脽羝?。在本文中,將學習如何使用 C# 將動畫應用于 PowerPoint 中的文本。
要將動畫應用于 PowerPoint 演示文稿中的文本,我們將使用Aspose.Slides for .NET,它是一個功能豐富且易于使用的 API,用于創建和操作 PowerPoint 和 OpenOffice 演示文稿。
>>你可以點擊這里下載Aspose.Slides 最新版測試體驗。
Aspose.Slides for .NET提供了超過150種動畫效果的支持,包括Bounce、PathFootball、Zoom等,另外還提供了OLEObjectShow、OLEObjectOpen等特定的動畫效果。所有支持的動畫效果都列在EffectType枚舉中。
以下是使用 C# 將動畫應用于 PowerPoint 演示文稿中的文本的步驟。
以下代碼示例展示了如何對 PowerPoint 演示文稿中的文本應用動畫效果。
// Load presentation using (Presentation presentation = new Presentation("Presentation.pptx")) { // Select paragraph to add effect IAutoShape autoShape = (IAutoShape)presentation.Slides[0].Shapes[0]; IParagraph paragraph = autoShape.TextFrame.Paragraphs[0]; // Add Fly animation effect to selected paragraph IEffect effect = presentation.Slides[0].Timeline.MainSequence.AddEffect(paragraph, EffectType.Fly, EffectSubtype.Left, EffectTriggerType.OnClick); // Save presentation presentation.Save("AnimationEffectinParagraph.pptx", SaveFormat.Pptx); }
您還可以獲得有關應用于特定文本的動畫效果的信息。當您需要對演示文稿中的另一個文本應用相同的效果時,這會很有用。
以下是獲取有關應用于文本的動畫效果的信息的步驟。
以下代碼示例展示了如何獲取有關文本動畫效果的信息。
// Load presentation using (Presentation pres = new Presentation("Presentation.pptx")) { // Get sequence and shape from slide ISequence sequence = pres.Slides[0].Timeline.MainSequence; IAutoShape autoShape = (IAutoShape)pres.Slides[0].Shapes[1]; // Loop through the paragraphs foreach (IParagraph paragraph in autoShape.TextFrame.Paragraphs) { // Access animation effects IEffect[] effects = sequence.GetEffectsByParagraph(paragraph); if (effects.Length > 0) Console.WriteLine("Paragraph \"" + paragraph.Text + "\" has " + effects[0].Type + " effect."); } }
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn