List of usage examples for org.apache.poi.hslf.record DocumentAtom getRecordType
public long getRecordType()
From source file:br.pucrio.telemidia.ncl30.ppt2ncl.tests.Animations.java
License:Open Source License
public static void main(String[] args) { SlideShow ppt;/* ww w. j av a2s.c o m*/ try { ppt = new SlideShow(new HSLFSlideShow("exemplos/A01introducao.ppt")); Slide[] slide = ppt.getSlides(); Document doc = ppt.getDocumentRecord(); DocumentAtom docAtom = doc.getDocumentAtom(); docAtom.getRecordType(); for (int i = 0; i < slide.length; i++) { // extract all pictures contained in the presentation PictureData[] pdata = slide[i].getSlideShow().getPictureData(); for (int j = 0; j < pdata.length; j++) { PictureData pict = pdata[j]; // picture data byte[] data = pict.getData(); int type = pict.getType(); String ext; switch (type) { case Picture.JPEG: ext = ".jpg"; break; case Picture.PNG: ext = ".png"; break; case Picture.WMF: ext = ".wmf"; break; case Picture.EMF: ext = ".emf"; break; case Picture.PICT: ext = ".pict"; break; default: continue; } FileOutputStream out; try { out = new FileOutputStream("exemplos/tests/pict_" + i + ext); out.write(data); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }