We can run the power point presentation in VB.net
Following is the Name space required for this presentation
Imports Office = Microsoft.Office.Core Imports Graph = Microsoft.Office.Interop.Graph Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
Create one windows application. Create one button control. In the button control double click write the following code.
Const MyTemplate = "C:\Program Files\Microsoft Office\Templates\Presentation Designs\Blends.pot" Const MyPicture = "C:\WINNT\Soap Bubbles.bmp"
Dim MyApplication As PowerPoint.Application Dim MyPresentation As PowerPoint.Presentation Dim MySlide As PowerPoint.Slide Dim MyAssistantOn As Boolean
MyApplication = New PowerPoint.Application() MyApplication.Visible = True MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
MyPresentation = MyApplication.Presentations.Open(sTemplate, , , True)
MySlide = MyPresentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly) With MySlide.Shapes.Item(1).TextFrame.TextRange .Text = "My Presentation" .Font.Name = "Vardana" .Font.Size = 36 End With MySlide.Shapes.AddPicture(MyPicture, False, True, 150, 150, 500, 350) MySlide = Nothing
MySlide = MyPresentation.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly) With MySlide.Shapes.Item(1).TextFrame.TextRange .Text = "My Chart Presentation" .Font.Name = "Comic Sans MS" .Font.Size = 48 End With Dim MyChart As Graph.Chart MyChart = MySlide.Shapes.AddOLEObject(150, 150, 480, 320,MSGraph.Chart.8").OLEFormat.Object
MyChart.ChartType = Graph.XlChartType.xl3DPie MyChart = Nothing MySlide = Nothing
MySlide = MyPresentation.Slides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank) MySlide.FollowMasterBackground = False Dim MyShape As PowerPoint.Shape MyShape = MySlide.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect27, "The End", "Impact", 96, False, False, 230, 200) MyShape.Shadow.ForeColor.SchemeColor = PowerPoint.PpColorSchemeIndex.ppForeground MyShape.Shadow.Visible = True MyShape.Shadow.OffsetX = 3 MyShape.Shadow.OffsetY = 3 MyShape = Nothing MySlide = Nothing
Dim SlideIdx(3) As Integer SlideIdx(0) = 1 SlideIdx(1) = 2 SlideIdx(2) = 3 With MyPresentation.Slides.Range(SlideIdx).SlideShowTransition .AdvanceOnTime = True .AdvanceTime = 3 .EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut End With Dim MySettings As PowerPoint.SlideShowSettings MySettings = MyPresentation.SlideShowSettings MySettings.StartingSlide = 1 MySettings.EndingSlide = 3
MyAssistantOn = MyApplication.Assistant.On MyApplication.Assistant.On = False
MySettings.Run() Do While MyApplication.SlideShowWindows.Count >= 1 System.Windows.Forms.Application.DoEvents() Loop MySettings = Nothing
If MyAssistantOn Then MyApplication.Assistant.On = True MyApplication.Assistant.Visible = False End If
MyPresetation.Saved = True MyPresetation.Close() MyPresetation = Nothing MyApplication.Quit() MyApplication = Nothing GC.Collect() End Sub
When you click the button you can see the power point presentation.
Thanks Nathan
|
No responses found. Be the first to respond and make money from revenue sharing program.
|