Java adds footers to PowerPoint documents



In the production of PowerPoint slides, you may encounter the need to add the page number, time, company name and other landmark content to the slide. At this point, we can do this by inserting the header and footers. This paper will useFree Spire.Presentation for JavaThe free control demonstrates how to add a page number, time, and company name to a PowerPoint Slide in a java program.

Test environment construction

Before running the code, you need to build a test environment. First download, install and configure JDK and IntelliJ idea, and then import the jar package in the control into idea. Here are two import methods for you.firstly, directly inOfficial websiteDownload the installation package and unzip it to the Lib folder Spire.Presentation.jar And finally import it manually into idea.secondRecommended), create a maven project in idea, and then pom.xml Type the following code into the file, and finally click “import changes.”. More detailed steps can be referred toThis tutorial


last,Import effectAs shown in the figure below:

Java adds footers to PowerPoint documents

Code example

import com.spire.presentation.*;
public class AddFooter {
    public static void main(String[] args) throws Exception {
        //Load ppt sample document
 Presentation presentation = new Presentation();
        //Add footers
 presentation.setFooterText (Zhengfei Media Co., Ltd.);
        //Set footers to visible
        //Set page number to visible
        //Set date to visible
        //Save result document
 presentation.saveToFile("output/AddFooter.pptx", FileFormat.PPTX_2010);

design sketch:

Java adds footers to PowerPoint documents