web 2.0

ASP.NET(vb.net) & PowerPoint - AddTextbox

ASP.NET(vb.net) & PowerPoint - AddTextbox - This isĀ  example scripts how to use ASP.NET Slides and AddTextbox to Presentations.

ShotDev Focus:
- ASP.NET(vb.net) & PowerPoint - AddTextbox

Example

AspNetPowerPointAddTextbox.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetPowerPointAddTextbox.aspx.vb" Inherits="AspNetPowerPointAddTextbox" %>
<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>

AspNetPowerPointAddTextbox.aspx.vb


Imports Microsoft.Office.Interop.PowerPoint
Partial Class AspNetPowerPointAddTextbox
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'*** Constant ***'
Const ppLayoutBlank = 12
Const ppLayoutChart = 8
Const ppLayoutChartAndText = 6
Const ppLayoutClipartAndText = 10
Const ppLayoutClipArtAndVerticalText = 26
Const ppLayoutFourObjects = 24
Const ppLayoutLargeObject = 15
Const ppLayoutMediaClipAndText = 18
Const ppLayoutMixed = -2
Const ppLayoutObject = 16
Const ppLayoutObjectAndText = 14
Const ppLayoutObjectAndTwoObjects = 30
Const ppLayoutObjectOverText = 19
Const ppLayoutOrgchart = 7
Const ppLayoutTable = 4
Const ppLayoutText = 2
Const ppLayoutTextAndChart = 5
Const ppLayoutTextAndClipart = 9
Const ppLayoutTextAndMediaClip = 17
Const ppLayoutTextAndObject = 13
Const ppLayoutTextAndTwoObjects = 21
Const ppLayoutTextOverObject = 20
Const ppLayoutTitle = 1
Const ppLayoutTitleOnly = 11
Const ppLayoutTwoColumnText = 3
Const ppLayoutTwoObjects = 29
Const ppLayoutTwoObjectsAndObject = 31
Const ppLayoutTwoObjectsAndText = 22
Const ppLayoutTwoObjectsOverText = 23
Const ppLayoutVerticalText = 25
Const ppLayoutVerticalTitleAndText = 27
Const ppLayoutVerticalTitleAndTextOverChart = 28

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.AddTextbox(1, 50, 150, 700, 100)
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "I Love ShotDev.Com 2"

ppSlide1.Shapes.AddTextbox(1, 50, 200, 700, 100)
ppSlide1.Shapes(3).TextFrame.TextRange.Text = "I Love ShotDev.Com 3"

ppSlide1.Shapes.AddTextbox(1, 50, 250, 700, 100)
ppSlide1.Shapes(4).TextFrame.TextRange.Text = "I Love ShotDev.Com 4"

ppSlide1.Shapes.AddTextbox(1, 50, 300, 700, 100)
ppSlide1.Shapes(5).TextFrame.TextRange.Text = "I Love ShotDev.Com 5"

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 - AddTextbox

.
.
.
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.