Skip to main content
All docs
V25.1
  • Configure Slide Footers with DevExpress Presentation API

    • 4 minutes to read

    Presentation slides can display a footer with footer text, date, and slide number. The DevExpress Presentation Library API allows you to add, edit, and remove these footer sections.

    presentation api footers example

    Important

    The DevExpress Presentation API Library is currently available as a Community Technology Preview (CTP). Note that we do not recommend that you integrate pre-release libraries into mission-critical software applications. You can try the library and share your feedback so that we can make necessary adjustments before the official release. To start a conversation, submit a ticket via the DevExpress Support Center — we’d love to hear from you.

    You can customize the footer of a master slide layout or individual slide.

    Customize the Slide Master

    You can use the SlideMaster object to specify a footer in a slide master layout. The following placeholder shapes are available:

    ActualDateTimePlaceholder
    Obtains the date and time placeholder shape.
    ActualFooterPlaceholder
    Retrieves placeholder shape for footer text.
    ActualSlideNumberPlaceholder
    Gets slide number’s placeholder shape.
    ActualNotesPlaceholder
    Obtains placeholder shape for slide notes.

    To specify display text in each placeholder shape, use the TextArea.Text property.

    The following code snippet specifies content for footer text and date/time sections in the slide master layout:

    presentation api footers slide master

    using DevExpress.Docs.Presentation;
    //...
    using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\presentation1.pptx"))) {
        SlideMaster slideMaster = presentation.SlideMasters[0];
    
        slideMaster.ActualDateTimePlaceholder.TextArea.Text = DateTime.Now.ToString("dddd dd MMMM yyyy");
        slideMaster.ActualFooterPlaceholder.TextArea.Text = "Created by DevExpress Presentation API";
    
        presentation.SaveDocument(new FileStream("C://Documents//presentation-updated.pptx", FileMode.OpenOrCreate, FileAccess.ReadWrite));
    }
    

    Customize an Individual Slide

    The HeaderFooterManager class allows you to add footer text, date, and slide numbers to its associated presentation.

    Obtain a Slide from the Presentation.Slides collection and pass it to the HeaderFooterManager.Add...Placeholder method to add a footer section to the slide.

    Pass a list of Slide objects as the method parameter to display footers on multiple slides.

    The following code snippet adds footer text, date and time, and a slide number to the first slide:

    presentation api footers added to slide

    using DevExpress.Docs.Presentation;
    //...
    using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\presentation.pptx"))) {
    
        var firstSlide = presentation.Slides[0];
        var headerFooterManager =  presentation.HeaderFooterManager;
    
        headerFooterManager.AddFooterPlaceholder(firstSlide, "Created with DevExpress Presentation API");
        headerFooterManager.AddSlideNumberPlaceholder(firstSlide);
        headerFooterManager.AddDateTimePlaceholder(firstSlide, DateTime.Now.ToString());
        presentation.SaveDocument(new FileStream("C://Documents//presentation_updated.pptx", FileMode.OpenOrCreate, FileAccess.ReadWrite));
    }
    

    Use the following properties to obtain footer placeholders of an individual slide (obtained by the Presentation.Slides property) or a slide master layout (obtained by the Presentation.SlideMasters property):

    ActualDateTimePlaceholder
    Obtains the date and time placeholder shape.
    ActualFooterPlaceholder
    Retrieves the footer text placeholder shape.
    ActualSlideNumberPlaceholder
    Gets the slide number placeholder shape.

    To specify placeholder shape content, use the TextArea.Text property.

    Note

    A shape’s default character formatting settings may not produce consistent results across different presentation viewers. To ensure consistent appearance, specify character formatting settings explicitly in code.

    The following code snippet customized the footer on the third slide (specifies font color for footer text and slide number, outlines the date and time shape):

    presentation api footer changed

    using DevExpress.Docs;
    using DevExpress.Docs.Presentation;
    
    using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\presentation.pptx"))) {
        var slide = presentation.Slides[2];
    
        slide.ActualDateTimePlaceholder.Outline = new OutlineStyle { Fill = new SolidFill(Color.Green), Width = 4 };
        var textArea =  slide.ActualFooterPlaceholder.TextArea;
    
        ParagraphProperties textParagraphProperties = new ParagraphProperties() {
            TextProperties = new TextProperties() {
                HighlightColor = new OfficeColor(Color.Red)
            }
        };
        textArea.ParagraphProperties = textParagraphProperties;
        textArea.Level1ParagraphProperties = textParagraphProperties;
    
        presentation.SaveDocument(new FileStream("C://Documents//presentation_updated.pptx", FileMode.OpenOrCreate, FileAccess.ReadWrite));
    }
    

    Remove Footers

    Call the Shapes.Remove method for the placeholder shape to remove a footer section from the slide.

    The following code snippet removes the slide number from the first slide:

    using DevExpress.Docs.Presentation;
    //...
    
    using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\Presentation.pptx"))) {
    
            var slide = presentation.Slides[0];
            while (slide.ActualFooterPlaceholder != null)
            {
                slide.Shapes.Remove(slide.ActualFooterPlaceholder);
            }
        presentation.SaveDocument(new FileStream("C://Documents//presentation_updated.pptx", FileMode.OpenOrCreate, FileAccess.ReadWrite));
    }