How to use ASP & PowerPoint - Add/Insert Picture (AddPicture) This is learn/tutorial asp developers how to using ASP script Create PowerPoint and Add/Insert Picture (AddPicture)
ShotDev Focus:
- ASP & Create PowerPoint and Add/Insert Picture (AddPicture)
Example
asp_ppt_picture.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% '*** Constant ***' Const ppLayoutTitleOnly = 11 Dim ppApp,ppPres,ppSlide1,ppName Set ppApp = Server.CreateObject("PowerPoint.Application") ppName = "MyPP/MyPPt.ppt" Set ppPres = ppApp.Presentations.Add(1) Set ppSlide1 = ppPres.Slides.Add(1,ppLayoutTitleOnly) '*** 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.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.AddPicture Server.MapPath("logo.gif"),0,1,250,330,200,100 '*** Picture,Left,Top,Width,Height ***' ppApp.Presentations(1).SaveAs(Server.MapPath(ppName)) 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_picture.asp
Screenshot