POI 3.13版本,pptx转换为图片时,ppt中内容出现丢失,求大神指点!急急急!

青峡丶君子陌 2015-11-05 02:50:12
这是官方文档代码

FileInputStream is = new FileInputStream("e:/test/35.2014年全行网点零售业务效能评估报告.pptx");
XMLSlideShow ppt = new XMLSlideShow(is);
is.close();

Dimension pgsize = ppt.getPageSize();

int idx = 1;
for (XSLFSlide slide : ppt.getSlides()) {//XSLFSheet

BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
// clear the drawing area
graphics.setPaint(Color.WHITE);

// graphics.setPaint();
graphics.setBackground(slide.getBackground().getFillColor());
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));



// render
slide.draw(graphics);

// save the output
FileOutputStream out = new FileOutputStream("e:/test/ppt-image/slide-" + idx + ".png");
javax.imageio.ImageIO.write(img, "png", out);
out.close();

idx++;
}

这是ppt中内容,手动截出的图:


这是通过POI,程序截出的图:
...全文
1173 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
初学者-java 2016-07-25
  • 打赏
  • 举报
回复
问题解决没?求解决
Vio_ao 2016-03-02
  • 打赏
  • 举报
回复
3.13也需要这个问题。是在是坑。怎么解决的?
wangsufu77 2015-12-15
  • 打赏
  • 举报
回复
我也遇到这个问题,楼主解决了吗?
harukong 2015-12-04
  • 打赏
  • 举报
回复
楼主解决了吗?网上有的方法用3.11的jar包可以实现;用3.13的就不行了
青峡丶君子陌 2015-11-05
  • 打赏
  • 举报
回复
第一次发帖就沉吗?

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧