/*
   create a blend animation in PowerPoint
   taken from Example04.cs
*/
private void Example04Main()
{
    // start powerpoint 
    PowerPoint.Application powerApplication = new PowerPoint.Application();

    // add a new presentation with two new slides
    PowerPoint.Presentation presentation = 
powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide1 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); PowerPoint.Slide slide2 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add shapes slide1.Shapes.AddShape(MsoAutoShapeType.msoShape4pointStar, 100, 100, 200, 200); slide2.Shapes.AddShape(MsoAutoShapeType.msoShapeDoubleWave, 200, 200, 200, 200); // change blend animation slide1.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverDown; slide1.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; slide2.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverLeftDown; slide2.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example04{1}",
Application.StartupPath,
fileExtension);
presentation.SaveAs(documentFile,
PpSaveAsFileType.ppSaveAsDefault,
MsoTriState.msoTrue); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); FinishDialog fDialog = new FinishDialog("Presentation saved.", documentFile); fDialog.ShowDialog(this); } /// <summary> /// returns the valid file extension for the instance. for example ".ppt" or ".pptx" /// </summary> /// <param name="application">the instance</param> /// <returns>the extension</returns> private static string GetDefaultExtension(PowerPoint.Application application) { double Version = Convert.ToDouble(application.Version, CultureInfo.InvariantCulture); if (Version >= 12.00) return ".pptx"; else return ".ppt"; }

Last edited Jun 13, 2012 at 12:20 PM by SebastianDotNet, version 6