ASP.NET(vb.net) & PowerPoint - Save Slides To HTML Format - This isĀ example scripts how to use ASP.NET create Slides Presentations and Save Slides To HTML Format.
ShotDev Focus:
- ASP.NET(vb.net) & PowerPoint - Save Slides To HTML Format
Example
AspNetPowerPointSaveAsHTMLFormat.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetPowerPointSaveAsHTMLFormat.aspx.vb" Inherits="AspNetPowerPointSaveAsHTMLFormat" %> <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>
AspNetPowerPointSaveAsHTMLFormat.aspx.vb
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 = "shotdev.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 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.RGB = 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.RGB = wdColorBlue ppSlide1.Shapes.AddPicture(Server.MapPath("logo.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.ShotDev.Com Version" ppSlide2.Shapes(1).TextFrame.TextRange.Font.Color.RGB = 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" ppSlide3 = ppPres.Slides.Add(3, 4) ppSlide3.Shapes(1).TextFrame.TextRange.Text = "We Love ShotDev.Com" ppSlide3.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorBlue ppSlide4 = ppPres.Slides.Add(4, 5) ppSlide4.Shapes(1).TextFrame.TextRange.Text = "We Love ShotDev.Com" ppSlide4.Shapes(1).TextFrame.TextRange.Font.Color.RGB = 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() Me.lblText.Text = "PowerPoint Created <a href=" & ppName & ">Click here</a> to View." End Sub End Class
Screenshot