以下经验内容将介绍通过java编程来添加页脚到PPT幻灯片的方法。一般在PP哌囿亡噱T页脚处,可以添加页脚文字(常在幻灯片下方居中位置),添加日期(常在幻灯片下方左侧位置),添加子牟矾唤幻灯片页码(常在幻灯片下方右侧位置)。下面将详细介绍如何来添加以上页脚内容。
工具/原料
Free Spire.Presentation for Java (免费版)
IntelliJ IDEA
jar文件导入
1、通过官网下载jar包后,解压。并将lib文件夹下的Spire.Presentation.jar文件导入程序(导入结果如下)。
Java代码示例
1、import com.spire.presentation.*;public class AddFooter { public static void main(String[] args) throws Exception { //加载测试文档 Presentation ppt = new Presentation(); ppt.loadFromFile("test.pptx"); ppt.setFooterText("经济与管理学院制");//设置脚注文字 ppt.setFooterVisible(true);//设置脚注可见 ppt.setDateTimeVisible(true);//设置日期可见 ppt.setSlideNumberVisible(true);//设置页码可见 //保存文档 ppt.saveToFile("AddFooter.pptx",FileFormat.PPTX_2010); }}
2、页脚添加效果: