Imports Microsoft.Office.Interop.PowerPoint
Public Class AspNetPowerPointSaveAsHTMLFormat
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Const wdColorLightGreen = &HCCFFCC
Const wdColorBlue = &HCCFFCC
Dim ppApp As New Microsoft.Office.Interop.PowerPoint.Application
Dim ppPres As Presentation
Dim ppSlide1, ppSlide2, ppSlide3, ppSlide4 As Slide
Dim ppName As String = "MyPP/MyPPt"
Dim ppDoc As String = "thaicreate.ppt"
ppApp.Visible = True
ppPres = ppApp.Presentations.Open(Server.MapPath(ppDoc))
ppSlide1 = ppPres.Slides(1)
'*** AddTextbox, objControl.Left,objControl.Top,objControl.Width,objControl.Height ***'
ppSlide1.Shapes.AddTextbox(1, 50, 100, 700, 100) '***4
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 1"
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Size = 10
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorLightGreen
ppSlide1.Shapes.AddTextbox(1, 50, 150, 700, 100)
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 2"
ppSlide1.Shapes(2).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(2).TextFrame.TextRange.Font.Size = 20
ppSlide1.Shapes.AddTextbox(1, 50, 200, 700, 100)
ppSlide1.Shapes(3).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 3"
ppSlide1.Shapes(3).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(3).TextFrame.TextRange.Font.Size = 30
ppSlide1.Shapes.AddTextbox(1, 50, 250, 700, 100)
ppSlide1.Shapes(4).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 4"
ppSlide1.Shapes(4).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(4).TextFrame.TextRange.Font.Size = 40
ppSlide1.Shapes.AddTextbox(1, 50, 300, 700, 100)
ppSlide1.Shapes(5).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 5"
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Size = 50
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Color.RGB = wdColorBlue
ppSlide1.Shapes.AddPicture(Server.MapPath("thaicreate-2009.gif"), 0, 1, 310, 380, 100, 100) '*** Picture,Left,Top,Width,Height ***'
ppSlide2 = ppPres.Slides.Add(2, 3)
ppSlide2.Shapes(1).TextFrame.TextRange.Text = "www.ThaiCreate.Com Version"
ppSlide2.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorBlue
ppSlide2.Shapes(2).TextFrame.TextRange.Text = "Version 2008" & vbCr & _
"Version 2008" & vbCr & "Version 2008" & vbCr & "Version 2008"
ppSlide2.Shapes(3).TextFrame.TextRange.Text = "Version 2009" & vbCr & _
"Version 2009" & vbCr & "Version 2009" & vbCr & "Version 2009"
ppSlide3 = ppPres.Slides.Add(3, 4)
ppSlide3.Shapes(1).TextFrame.TextRange.Text = "We Love ThaiCreate.Com"
ppSlide3.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorBlue
ppSlide4 = ppPres.Slides.Add(4, 5)
ppSlide4.Shapes(1).TextFrame.TextRange.Text = "We Love ThaiCreate.Com"
ppSlide4.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorBlue
ppSlide4.Shapes(2).TextFrame.TextRange.Text = "2005" & vbCr & "2006" & vbCr & "2007" & vbCr & "2008" & vbCr & "2009"
ppApp.Presentations(1).SaveAs((Server.MapPath(ppName)), 12) '*** or 14 ***'
ppApp.Quit()
Me.lblText.Text = "PowerPoint Created <a href=" & ppName & ".htm>Click here</a> to View."
End Sub
End Class