本文概述
- Apache POI侧面图片示例
Apache POI侧面图片示例
package poiexample;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
public class ReOrderSlidesExample {
public static void main(String[] args) throws FileNotFoundException, IOException {
XMLSlideShow ppt = new XMLSlideShow();
try (OutputStream os = new FileOutputStream("srcmini.pptx")) {
XSLFSlide slide = ppt.createSlide();
byte[] pictureData = http://www.srcmini.com/IOUtils.toByteArray(new FileInputStream("jtp.png"));
XSLFPictureData pd = ppt.addPicture(pictureData, XSLFPictureData.PictureType.PNG);
XSLFPictureShape pic = slide.createPicture(pd);
ppt.write(os);
}catch(Exception e) {
System.out.println(e);
}
}
}
【apache poi powerpoint图像】输出:
文章图片
推荐阅读
- apache poi powerpoint布局
- apache poi powerpoint页面大小
- apache poi powerpoint幻灯片
- apache poi word文档段落
- apache poi超链接
- apache poi word表格
- apache poi word风格
- apache poi word对齐
- apache poi word提取文本