Create, read, write PowerPoint files in Classic ASP

GemBox.Presentation is a .NET library that enables you to process PowerPoint files from any .NET application. But it's also a COM accessible library that you can use in Classic ASP web pages as well.

System Requirements

To use GemBox.Presentation in VBScript, you'll need to:

  1. Download and install GemBox.Presentation Setup.
  2. Expose GemBox.Presentation to COM Interop with Regasm.exe tool:
    :: Add GemBox.Presentation to COM registry for x86 (32-bit) applications.
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe [path to installed GemBox.Presentation.dll]
    
    :: Add GemBox.Presentation to COM registry for x64 (64-bit) applications.
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe [path to installed GemBox.Presentation.dll]

Working with PowerPoint files in Classic ASP

The following example shows how you can read a PowerPoint file from a Classic ASP application, create new or update existing content, and write the modified presentation to output PowerPoint file.

Reading and writing slide content from PowerPoint files in Classic ASP
Screenshot of read and updated PowerPoint files
<%
  ' Create ComHelper object.
  Set comHelper = CreateObject("GemBox.Presentation.ComHelper")
  
  ' If using the Professional version, put your serial key below.
  comHelper.ComSetLicense("FREE-LIMITED-KEY")
  
  ' Read input presentation.
  Set presentation = comHelper.Load(Server.MapPath(".") & "\%#Input.pptx%")
  
  ' Get first slide.
  Set slide = comHelper.GetCollectionItem(presentation.Slides, 0)
  
  ' Remove first drawing.
  comHelper.RemoveCollectionItemAt(slide.Content.Drawings, 0)
  
  ' Get master slide.
  Set masterSlide = comHelper.GetCollectionItem(presentation.MasterSlides, 0)
  
  ' Get layout slide.
  Set layoutSlide = comHelper.GetCollectionItem(masterSlide.LayoutSlides, 0)
  
  ' Create new slide.
  slide = comHelper.AddNewSlide(presentation.Slides, layoutSlide)
  
  ' Create new shape.
  Set shape = slide.Content.AddShape(ShapeGeometryType.RoundedRectangle, 5, 5, 12, 6)
  
  ' Set shape fill to light blue color.
  shape.Format.Fill.SetSolid(comHelper.CreateColor(91, 155, 213))
  
  ' Create new paragraph with text.
  Set run = shape.Text.AddParagraph().AddRun("This is a new text box on a new slide.")
  
  ' Set text fill to white color.
  run.Format.Fill.SetSolid(comHelper.CreateColor(255, 255, 255))
  
  ' Write output presentation.
  presentation.Save(Server.MapPath(".") & "\Output.pptx")
%>

Wrapper Library

Not all members of GemBox.Presentation are accessible because of the COM limitations like unsupported static and overload methods. That is why you can use the ComHelper class which provides alternatives for some members that cannot be called with COM Interop.

However, if you need to use many GemBox.Presentation members from VBScript, a recommended approach is to create a .NET wrapper library instead. Your wrapper library should do all the work within and exposes a minimal set of classes and methods to the unmanaged code.

This will enable you to take advantage of GemBox.Presentation's full capabilities, avoid any COM limitations, and improve performance by reducing the number of COM Callable Wrappers created at runtime.

See also


Next steps

GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Download Buy