我试图用Apache POI从ppt文件中提取幻灯片,没有问题,但现在我打算打开pptx文件并做同样的事情,有谁知道怎么做?
这是从ppt文件中提取图像的代码:
public ImageIcon display() throws JPresentationException {
Background background;
background = slides[current].getBackground();
Fill f = background.getFill();
Color color = f.getForegroundColor();
Dimension dimension = ppt.getPageSize();
shapes = slides[current].getShapes();
BufferedImage img = new BufferedImage(dimension.width, dimension.height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
graphics.setPaint(color);
graphics.fill(new Rectangle2D.Float(0, 0, dimension.width, dimension.height));
slides[current].draw(graphics);
ImageIcon icon = new ImageIcon(img);
return icon;
}