How to use ASP & PowerPoint - Save Slides To HTML Format This is learn/tutorial asp developers how to using ASP script Create PowerPoint and Save Slides To HTML Format
ShotDev Focus:
- ASP & Create PowerPoint and Save Slides To HTML Format
Example
asp_ppt_html.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Const wdColorLightGreen = &HCCFFCC Const wdColorBlue = &HCCFFCC Dim ppApp,ppPres,ppSlide1,ppSlide2,ppSlide3,ppSlide4,ppName,ppDoc,objTextRng Set ppApp = Server.CreateObject("PowerPoint.Application") ppApp.Visible = True ppDoc = "shotdev.ppt" ppName = "MyPP/MyPPt.ppt" Set ppPres = ppApp.Presentations.Open(Server.MapPath(ppDoc)) Set 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 ShotDev.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 = wdColorLightGreen ppSlide1.Shapes.AddTextbox 1,50,150,700,100 ppSlide1.Shapes(2).TextFrame.TextRange.Text = "I Love ShotDev.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 ShotDev.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 ShotDev.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 ShotDev.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 = wdColorBlue ppSlide1.Shapes.AddPicture Server.MapPath("logo.gif"),0,1,310,380,100,100 '*** Picture,Left,Top,Width,Height ***' Set ppSlide2 = ppPres.Slides.Add(2,3) ppSlide2.Shapes(1).TextFrame.TextRange.Text = "www.ShotDev.Com Version" ppSlide2.Shapes(1).TextFrame.TextRange.Font.Color = wdColorBlue ppSlide2.Shapes(2).TextFrame.TextRange.Text = "Version 2009" & vbCr & _ "Version 2009" & vbCr & "Version 2009" & vbCr & "Version 2009" ppSlide2.Shapes(3).TextFrame.TextRange.Text = "Version 2010" & vbCr & _ "Version 2010" & vbCr & "Version 2010" & vbCr & "Version 2010" Set ppSlide3 = ppPres.Slides.Add(3,4) ppSlide3.Shapes(1).TextFrame.TextRange.Text = "We Love ShotDev.Com" ppSlide3.Shapes(1).TextFrame.TextRange.Font.Color = wdColorBlue Set ppSlide4 = ppPres.Slides.Add(4,5) ppSlide4.Shapes(1).TextFrame.TextRange.Text = "We Love ShotDev.Com" ppSlide4.Shapes(1).TextFrame.TextRange.Font.Color = wdColorBlue ppSlide4.Shapes(2).TextFrame.TextRange.Text = "2006" & vbCr & "2007" & vbCr & "2008" & vbCr & "2009" & vbCr & "2010" ppApp.Presentations(1).SaveAs(Server.MapPath(ppName)),12 '*** or 14 ***' ppApp.Quit Set ppApp = Nothing %> PowerPoint Created <a href="<%=ppName%>">Click here</a> to Download. </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_ppt_html.asp
Screenshot