package ppt_gen;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
public class CreatePresentation {
public static void main(String args[]) throws IOException{
//creating a new empty slide show
XMLSlideShow ppt = new XMLSlideShow();
//creating an FileOutputStream object
File file =new File("example1.pptx");
FileOutputStream out = new FileOutputStream(file);
//saving the changes to a file
ppt.write(out);
System.out.println("Presentation created successfully");
out.close();
}
}
这个异常背后的原因是什么? 线程“main”中的异常java.lang.RuntimeException:缺少资源'empty.pptx' 在org.apache.poi.xslf.usermodel.XMLSlideShow.empty(XMLSlideShow.java:98) 在org.apache.poi.xslf.usermodel.XMLSlideShow。(XMLSlideShow.java:73) 在ppt_gen.CreatePresentation.main(CreatePresentation.java:12) Java结果:1 建立成功(总时间:0秒)