web 2.0

ASP.NET(vb.net) & PowerPoint - Add/Insert Picture (AddPicture)

ASP.NET(vb.net) & PowerPoint - Add/Insert Picture (AddPicture) - This isĀ  example scripts how to use ASP.NET Slides and add insert Picture (AddPicture) to Presentations.

ShotDev Focus:
- ASP.NET(vb.net) & PowerPoint - Add/Insert Picture (AddPicture)

Example

AspNetPowerPointAddPicture.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetPowerPointAddPicture.aspx.vb" Inherits="AspNetPowerPointAddPicture" %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="server"></asp:Label>
</form>
</body>
</html>

AspNetPowerPointAddPicture.aspx.vb


Imports Microsoft.Office.Interop.PowerPoint
Public Class AspNetPowerPointAddPicture
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'*** Constant ***'
Const ppLayoutTitleOnly = 11

Dim ppApp As New Microsoft.Office.Interop.PowerPoint.Application
Dim ppPres As Presentation
Dim ppSlide1 As Slide
Dim ppName As String = "MyPP/MyPPt.ppt"

ppPres = ppApp.Presentations.Add(1)

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()
ppApp = Nothing

Me.lblText.Text = "PowerPoint Created <a href=" & ppName & ">Click here</a> to Download."

End Sub
End Class

Screenshot

ASP.NET(vb.net) & PowerPoint - Add/Insert Picture (AddPicture)

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.