' create a blend animation with PowerPoint
' taken from Example04.vb

Private Sub Example04Main()

   ' start powerpoint 
   Dim powerApplication As New PowerPoint.Application()

   ' add a new presentation with two new slides
   Dim presentation As PowerPoint.Presentation = _
powerApplication.Presentations.Add(MsoTriState.msoTrue) Dim slide1 As PowerPoint.Slide = presentation.Slides.Add(1, _
PpSlideLayout.ppLayoutBlank) Dim slide2 As PowerPoint.Slide = presentation.Slides.Add(2, _
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 Dim fileExtension As String = GetDefaultExtension(powerApplication) Dim documentFile As String = String.Format("{0}\\Example02{1}", _
Application.StartupPath, _
fileExtension) presentation.SaveAs(documentFile, _
PpSaveAsFileType.ppSaveAsDefault, _
MsoTriState.msoTrue) ' close power point and dispose reference powerApplication.Quit() powerApplication.Dispose() Dim fDialog As New FinishDialog("Presentation saved.", documentFile) fDialog.ShowDialog(Me) End Sub ''' <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> ''' <remarks></remarks> Private Function GetDefaultExtension(ByVal application As PowerPoint.Application) As String Dim version As Double = _
Convert.ToDouble(application.Version, CultureInfo.InvariantCulture)
If (version >= 12.0) Then Return ".pptx" Else Return ".ppt" End If End Function

Last edited Jun 13, 2012 at 1:07 PM by SebastianDotNet, version 8

Comments

No comments yet.