Java/ Add Footer to PowerPoint Document

Java/ Add Footer to PowerPoint Document

·

1 min read

The footer in a PowerPoint document is often used to display some additional information such as time, date, page number, theme, logo. In this article, you will learn how to add footer to PowerPoint document using Free Spire.Presentation for Java.

Import JAR Dependency (2 Methods)

● Download the free library and unzip it, and then add the Spire.Presentation.jar file to your project as dependency.
● You can also add the jar dependency to your maven project by adding the following configurations to the pom.xml.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.presentation.free</artifactId>
        <version>3.9.0</version>
    </dependency>
</dependencies>

The Presentaion.setFooterText() method provided by Free Spire.Presentation for Java allows you to add text in the footer. And by setting the values of Presentation.setSlideNumberVisible() method and Presentation.setDateTimeVisible() method to true, you can also add page number as well as date to the footer. The complete sample code is as follows.

import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;

public class AddFooter {
    public static void main(String[] args) throws Exception {
        //Load a PPT document
        Presentation presentation = new Presentation();
        presentation.loadFromFile("William Blake.pptx");

        //Add footer
        presentation.setFooterText("Biography of William Blake");
        //Set the footer visible
        presentation.setFooterVisible(true);
        //Set the page number visible
        presentation.setSlideNumberVisible(true);
        //Set the date visible
        presentation.setDateTimeVisible(true);

        //Save the document
        presentation.saveToFile("AddFooter.pptx", FileFormat.PPTX_2010);
    }
}

PPTFooter.jpg