个性化阅读
专注于IT技术分析

apache poi powerpoint幻灯片

本文概述

要在Powerpoint文档中创建新的Slide,我们可以使用createSlide()方法。此方法创建一个新的空幻灯片。让我们来看一个例子。

Apache POI Powerpoint幻灯片示例

package poiexample;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
public class CreatingPptExample {
	public static void main(String[] args) {
		XMLSlideShow ppt = new XMLSlideShow();
	    try (OutputStream os = new FileOutputStream("srcmini.pptx")) {
	    XSLFSlide slide = ppt.createSlide();
	    ppt.write(os);
	    }catch(Exception e) {
	    	System.out.println(e);
	    }
	}
}

输出:

赞(0)
未经允许不得转载:srcmini » apache poi powerpoint幻灯片

评论 抢沙发

评论前必须登录!