Guide for VB.NET
Core Document Formats
Additional Features

VB.NET PowerPoint - VB Guide for Slide Modification

How to Insert, Add or Delete Slide in/from PowerPoint Document Using VB.NET

VB.NET
Home > .NET Imaging SDK > VB.NET > PowerPoint: Add, Insert & Delete Slide
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

In the daily life application, we may often need to insert a new slide into source PowerPoint document as a method to add new information. Also we may need to remove certain unwanted or unnecessary slide from PPT (.pptx) document file. And this online VB.NET tutorial page will guide you how to add a new slide into source PowerPoint file and how to delete an existing slide from target PPT (.pptx) document using VB.NET programming language. Following is the article layout.
Related .net document control helps:
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net excel web viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net document viewer control: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
  • How to insert & add new slide into PowerPoint document file using VB.NET API and demo code
  • How to delete selected slide from PPT (.pptx) using VB.NET API and sample code
How to Add & Insert Slide
This VB.NET PowerPoint slide modifying control add-on offers two methods for users to insert & add new slide in PPT (.pptx) document file. One is AddPage and the other is InsertPage. In this section, we will offer separate VB.NET APIs and demo codes for adding & inserting new slide into source PowerPoint document file using different slide inserting & adding methods.
But before giving detailed VB.NET APIs and demo codes, we will introduce two programming classes first.
  • PPTXDocument: PPTXDocument is a programming class which is defined as a high-level model to represent one PowerPoint document file in .NET class application. This PPTXDocument object can be created by decoding PowerPoint from web path or PC file into VB.NET class application using this VB.NET PPT (.pptx) reading & editing control add-on.
  • PPTXPage: Similarly, PPTXPage is an abstraction of one PPT (.pptx) slide and one PPTXPage object contains all information encoded into source PowerPoint slide. For displaying purpose, we regard one PowerPoint slide as a page.

Use AddPage Method

The AddPage method provided by this VB.NET PowerPoint slide modifying control toolkit allows developers to add new slide into source PowerPoint file but new slide can be only added to the end of the target PPT (.pptx) document. That is to say, if you add a slide to a PPT file which has 8 slides using AddPage, the index of newly added slide can only be 8. The index of first slide is defined as 0.
Here we provide the VB.NET API and demo code that will be used in the process of adding new slide using AddPage method.
Private Sub AddPage(page As BasePage) Implements PPTXDocument.AddPage
End Sub
''' <summary>
''' Add slide to the end of the PowerPoint document.
''' </summary>
''' <param name="doc"></param>
''' <param name="page"></param>
Public Sub AddPageToDocument(doc As PPTXDocument, page As PPTXPage)
doc.AddPage(page)
End Sub

Use InsertPage Method

Different from the AddPage method, this InsertPage method can not only allow VB.NET developers to insert new slide into source PPT file but also enable VB.NET programmers to decide where the new slide will be inserted. Note: the newly slide will be inserted into specified position. For example, if you want to insert a slide into a target PPT document and you want the newly inserted slide to be slide 4, then you just define the idx value as 3 using InsertPage method.
VB.NET API and two demo codes are offered here to help developers insert new slide into source PPT (.pptx) file using InsertPage method.
Private Sub InsertPage(page As BasePage, pageIndex As Integer) Implements PPTXDocument.InsertPage
End Sub
''' <summary>
''' Insert a slide to PowerPoint document.
''' </summary>
''' <param name="doc"></param>
''' <param name="page"></param>
''' <param name="idx"></param>
Public Sub InsertPageToPPTXDocument(doc As PPTXDocument, page As PPTXPage, idx As Integer)
doc.InsertPage(page, idx)
End Sub
''' <summary>
''' Create an empty page and insert it into an existing PPTXDocument.
''' </summary>
''' <param name="doc"></param>
''' <param name="idx"></param>
Public Sub CreateAndInsertEmptyPage(doc As PPTXDocument, idx As Integer)
Dim page As New PPTXPage()
doc.InsertPage(page, idx)
End Sub
Note: with the help of this VB.NET PowerPoint page modifying control add-on, developers can insert a blank slide or a slide extracted from other PowerPoint file into target PPT (.pptx) document file using AddPage or InsertPage method.
How to Delete Slide
This VB.NET PowerPoint slide modifying control add-on enables developers to delete or remove any specified slide from source PPT document. The API and demo code below is displayed here to help you remove certain slide(s) from target PowerPoint file using VB.NET programming code.
Private Sub DeletePage(pageIdx As Integer) Implements PPTXDocument.DeletePage
End Sub
''' <summary>
''' Delete pages from PowerPoint document.
''' </summary>
''' <param name="filePath"></param>
''' <param name="pageIndx"></param>
Public Sub DeletePage(filePath As [String], pageIndx As Integer)
Dim doc As New PPTXDocument(filePath)
doc.DeletePage(pageIndx)
End Sub
To view C# code for adding, inserting or deleting slide to/from PowerPoint document file, please read this C# PPT (.pptx) slide modifying tutorial page. To view more VB.NET PowerPoint slide processing functions, please read VB.NET PPT (.pptx) slide processing guide page.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com