1
我想用Apache POI從ppt
文件中提取幻燈片,這裏沒有問題,但現在我打算打開pptx
文件並執行相同的操作,是否有人知道如何??用apache poi從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;
}
你的問題聽起來很奇怪,但我認爲這是有道理的,如果你真的認爲你可以用ppt文件做到這一點。我編輯了你的答案,但如果這是不正確的回滾我的更改。 – jzd 2011-02-15 15:50:42