gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
Interop.PowerPoint 增加触发器 类型使用 从上一项开始
- User
Interop.PowerPoint 增加触发器 类型使用 从上一项开始
- Assistant
以下是使用Interop.PowerPoint在PowerPoint中向幻灯片中的对象添加"从上一项开始"触发器的示例代码:
csharpusing PowerPoint = Microsoft.Office.Interop.PowerPoint; // 获取当前PPT应用程序对象 PowerPoint.Application pptApp = new PowerPoint.Application(); // 打开PPT文档 PowerPoint.Presentation pptPresentation = pptApp.Presentations.Open("C:\\Presentation1.pptx"); // 获取第二张幻灯片对象 PowerPoint.Slide slide2 = pptPresentation.Slides[2]; // 获取目标对象(例如,shape、图片、文本框等) PowerPoint.Shape targetShape = slide2.Shapes[2]; // 添加"从上一项开始"触发器 PowerPoint.AnimationSettings animationSettings = pptPresentation.SlideShowSettings.Run().View.AnimationSettings; PowerPoint.Trigger trigger = animationSettings.Triggers.AddPreviousSiblingEffect(targetShape, PowerPoint.MsoAnimTriggerType.msoAnimTriggerOnPageClick); // 将触发器类型设置为"从上一项开始" trigger.ExitEffect.Type = PowerPoint.MsoAnimEffect.msoAnimEffectPathDown;