Adding, modifying, and removing footers in a PowerPoint document is crucial for enhancing the professionalism and readability of a presentation. By adding footers, you can include key information such as presentation titles, authors, dates, or page numbers, which helps the audience better understand the content. Modifying footers allows you to update information, making it more attractive and practical. Additionally, removing footers is also necessary, especially in certain situations such as when specific information is not required to be displayed at the bottom of each page for a particular occasion. In this article, you will learn how to add, modify, or remove footers in PowerPoint documents in C# using Spire.Presentation for .NET.
- C# Add Footers in PowerPoint Documents
- C# Modify Footers in PowerPoint Documents
- C# Remove Footers in PowerPoint Documents
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
C# Add Footers in PowerPoint Documents
Spire.Presentation enables the addition of footer, slide number, and date placeholders at the bottom of PowerPoint document pages to uniformly add the same footer content across all pages. Here are the detailed steps:
- Create a Presentation object.
- Load a PowerPoint document using the lisentation.LoadFromFile() method.
- Set Presentation.FooterVisible = true to make the footer visible and set the footer text.
- Set Presentation.SlideNumberVisible = true to make slide numbers visible, then iterate through each slide, check for the existence of a slide number placeholder, and modify the text to "Slide X" format if found.
- Set Presentation.DateTimeVisible = true to make date and time visible.
- Use the Presentation.SetDateTime() method to set the date format.
- Save the document using the Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
namespace SpirePresentationDemo
{
internal class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load the presentation from a file
presentation.LoadFromFile("Sample1.pptx");
// Set the footer visible
presentation.FooterVisible = true;
// Set the footer text to "Spire.Presentation"
presentation.SetFooterText("Spire.Presentation");
// Set slide number visible
presentation.SlideNumberVisible = true;
// Iterate through each slide in the presentation
foreach (ISlide slide in presentation.Slides)
{
foreach (IShape shape in slide.Shapes)
{
if (shape.Placeholder != null)
{
// If it is a slide number placeholder
if (shape.Placeholder.Type.Equals(PlaceholderType.SlideNumber))
{
TextParagraph textParagraph = (shape as IAutoShape).TextFrame.TextRange.Paragraph;
String text = textParagraph.Text;
// Modify the slide number text to "Slide X"
textParagraph.Text = "Slide " + text;
}
}
}
}
// Set date time visible
presentation.DateTimeVisible = true;
// Set date time format
presentation.SetDateTime(DateTime.Now, "MM/dd/yyyy");
// Save the modified presentation to a file
presentation.SaveToFile("AddFooter.pptx", FileFormat.Pptx2016);
// Dispose of the Presentation object resources
presentation.Dispose();
}
}
}

C# Modify Footers in PowerPoint Documents
To modify footers in a PowerPoint document, you first need to individually inspect the shapes on each slide, identify footer placeholders, page number placeholders, etc., and then set specific content and formats for each type of placeholder. Here are the detailed steps:
- Create a Presentation object.
- Load a PowerPoint document using the Presentation.LoadFromFile() method.
- Use the Presentation.Slides[index] property to retrieve a slide.
- Use a for loop to iterate through the shapes on the slide, individually checking each shape to determine if it is a placeholder for a footer, page number, etc., and then modify its content or format accordingly.
- Save the document using the Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
namespace SpirePresentationDemo
{
internal class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load the presentation from a file
presentation.LoadFromFile("Sample2.pptx");
// Get the first slide
ISlide slide = presentation.Slides[0];
// Iterate through shapes in the slide
for (int i = 0; i < slide.Shapes.Count; i++)
{
// Check if the shape is a placeholder
if (slide.Shapes[i].Placeholder != null)
{
// Get the placeholder type
PlaceholderType type = slide.Shapes[i].Placeholder.Type;
// If it is a footer placeholder
if (type == PlaceholderType.Footer)
{
// Convert the shape to IAutoShape type
IAutoShape autoShape = (IAutoShape)slide.Shapes[i];
// Set the text content to "E-ICEBLUE"
autoShape.TextFrame.Text = "E-ICEBLUE";
// Modify the text font
ChangeFont1(autoShape.TextFrame.Paragraphs[0]);
}
// If it is a slide number placeholder
if (type == PlaceholderType.SlideNumber)
{
// Convert the shape to IAutoShape type
IAutoShape autoShape = (IAutoShape)slide.Shapes[i];
// Modify the text font
ChangeFont1(autoShape.TextFrame.Paragraphs[0]);
}
}
}
// Save the modified presentation to a file
presentation.SaveToFile("ModifyFooter.pptx", FileFormat.Pptx2016);
// Dispose of the Presentation object resources
presentation.Dispose();
}
static void ChangeFont1(TextParagraph paragraph)
{
// Iterate through each text range in the paragraph
foreach (TextRange textRange in paragraph.TextRanges)
{
// Set the text style to italic
textRange.IsItalic = TriState.True;
// Set the text font
textRange.EastAsianFont = new TextFont("Times New Roman");
// Set the text font size to 34
textRange.FontHeight = 34;
// Set the text color
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = System.Drawing.Color.LightSkyBlue;
}
}
}
}

C# Remove Footers in PowerPoint Documents
To remove footers from a PowerPoint document, you first need to locate footer placeholders, page number placeholders, date placeholders, etc., within the slides, and then remove them from the collection of shapes on the slide. Here are the detailed steps:
- Create a Presentation object.
- Load a PowerPoint document using the Presentation.LoadFromFile() method.
- Use the Presentation.Slides[index] property to retrieve a slide.
- Use a for loop to iterate through the shapes on the slide, check if it is a placeholder, and if it is a footer placeholder, page number placeholder, date placeholder, remove it from the slide.
- Save the document using the Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
namespace SpirePresentationDemo
{
internal class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load the presentation from a file
presentation.LoadFromFile("Sample2.pptx");
// Get the first slide
ISlide slide = presentation.Slides[0];
// Iterate through shapes in the slide in reverse order
for (int i = slide.Shapes.Count - 1; i >= 0; i--)
{
// Check if the shape is a placeholder
if (slide.Shapes[i].Placeholder != null)
{
// Get the placeholder type
PlaceholderType type = slide.Shapes[i].Placeholder.Type;
// If it is a footer placeholder, slide number placeholder, or date placeholder
if (type == PlaceholderType.Footer || type == PlaceholderType.SlideNumber || type == PlaceholderType.DateAndTime)
{
// Remove it from the slide
slide.Shapes.RemoveAt(i);
}
}
}
// Save the modified presentation to a file
presentation.SaveToFile("RemoveFooter.pptx", FileFormat.Pptx2016);
// Dispose of the Presentation object resources
presentation.Dispose();
}
}
}

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.
