C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Graphics »

Power point presentation in VB.net


Posted Date: 26 Jun 2009    Resource Type: Code Snippets    Category: Graphics
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 10



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



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
PPT  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C++ Code to Draw a Hut using "graphics.h" header
Previous Resource: Resize an image
Return to Discussion Resource Index
Post New Resource
Category: Graphics


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use