Knowledgebase (2311)
Children categories
Slides are the most basic component of a PowerPoint document. Each PowerPoint presentation can be composed of a series of slides containing different elements, such as text, shapes, tables, and images. When you are working on a PowerPoint document, adding and removing slides are probably some of the most required actions. In this article, you will learn how to programmatically add or delete a PowerPoint slide using Spire.Presentation for .NET.
- Add a New Slide at the End of the PowerPoint Document
- Insert a New Slide Before a Specific Slide in PowerPoint
- Delete a Specific Slide from a PowerPoint Document
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Add a New Slide at the End of the PowerPoint Document
The Presentation.Slides.Append() method provided by Spire.Presentation for .NET allows you to append a new slide after the last slide of a PowerPoint document. The detailed steps are as follows.
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Add a new blank slide at the end of the document using Presentation.Slides.Append() method.
- Save the result document using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
namespace AddNewSlideinPowerPoint
{
class Program
{
static void Main(string[] args)
{
// Initialize an instance of Presentation class
Presentation presentation = new Presentation();
//Load a sample PowerPoint document
presentation.LoadFromFile("Sample.pptx");
//Add a new slide at the end of the document
presentation.Slides.Append();
//Save the result document
presentation.SaveToFile("AddSlide.pptx", FileFormat.Pptx2013);
}
}
}

Insert a New Slide Before a Specific Slide in PowerPoint
Sometimes you may also need to insert a slide before a specific slide to add additional supporting information, and below are the detailed steps to accomplish the task.
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Insert a blank slide before a specified slide using Presentation.Slides.Insert() method.
- Save the result document using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
namespace InsertSlideinPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation object
Presentation presentation = new Presentation();
//Load a sample PowerPoint document
presentation.LoadFromFile("Sample.pptx");
//Insert a blank slide before the second slide
presentation.Slides.Insert(1);
//Save the result document
presentation.SaveToFile("InsertSlide.pptx", FileFormat.Pptx2013);
}
}
}

Delete a Specific Slide from a PowerPoint Document
If you want to remove a unnecessary slide from the document, you can use the Presentation.Slides.RemoveAt(int index) method. The detailed steps are as follows.
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Remove a specified slide from the document using Presentation.Slides.RemoveAt() method.
- Save the result document using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
namespace DeletePowerPointSlide
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation object
Presentation presentation = new Presentation();
//Load a sample PowerPoint document
presentation.LoadFromFile("Sample.pptx");
//Remove the first slide
presentation.Slides.RemoveAt(0);
//Save the result document
presentation.SaveToFile("RemoveSlide.pptx", FileFormat.Pptx2013);
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Animation is a great way to emphasize important points, to control the flow of information, and to increase viewer interest in your presentation. You can animate text, pictures, shapes, tables, SmartArt graphics, and other objects in PowerPoint slide to give them visual effects. This article will focus on how to apply animation effect to a shape using Spire.Presentation in C#.
Step 1: Initialize an instance of Presentation class and get the first slide from the presentation.
Presentation ppt = new Presentation(); ISlide slide = ppt.Slides[0];
Step 2: Insert a rectangle in the slide and fill the shape with purple.
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 200, 80)); shape.Fill.FillType = FillFormatType.Solid; shape.Fill.SolidColor.Color = Color.Purple; shape.ShapeStyle.LineColor.Color = Color.White;
Step 3: Apply FadedSwivel animation effect to the shape.
shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.FadedSwivel);
Step 4: Save the file.
ppt.SaveToFile("animations.pptx", FileFormat.Pptx2010);
Output:

Full Code:
using Spire.Presentation;
using Spire.Presentation.Drawing.Animation;
using System.Drawing;
using Spire.Presentation.Drawing;
namespace SetAnimationsOnShapes
{
class Program
{
static void Main(string[] args)
{
Presentation ppt = new Presentation();
ISlide slide = ppt.Slides[0];
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 200, 80));
shape.Fill.FillType = FillFormatType.Solid;
shape.Fill.SolidColor.Color = Color.Purple;
shape.ShapeStyle.LineColor.Color = Color.White;
shape.AppendTextFrame("Animated Shape");
shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.FadedSwivel);
ppt.SaveToFile("animations.pptx", FileFormat.Pptx2010);
}
}
}
How to Convert PowerPoint Document to TIFF Image in C#, VB.NET
2014-05-16 03:09:57 Written by KoohjiConversion from PowerPoint to TIFF may be useful in order to fax the presentation files or send them off for printing. Spire.Presentation provides straightforward method SaveToFile to do the conversion, which automatically detects presentation slides and convert them to TIFF image (one image per slide).
Step 1: Create an instance of Presentation class.
Presentation ppt = new Presentation();
Step 2: Load a PowerPoint file.
ppt.LoadFromFile("template.pptx");
Step 3: Save to TIFF format file.
ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff);
Output:

Full Code:
using Spire.Presentation;
namespace PPTtoTIFF
{
class Program
{
static void Main(string[] args)
{
Presentation ppt = new Presentation();
ppt.LoadFromFile("template.pptx");
ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff);
}
}
}
Imports Spire.Presentation
Namespace PPTtoTIFF
Class Program
Private Shared Sub Main(args As String())
Dim ppt As New Presentation()
ppt.LoadFromFile("template.pptx")
ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff)
End Sub
End Class
End Namespace