Page 1 of 1

Re: getting images from docx

PostPosted: Mon Apr 08, 2013 8:32 am
by jason
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
public class Graphic {
       
        private static Logger log = Logger.getLogger(Graphic.class);
       
        private org.docx4j.dml.Graphic graphic;
       
        public Graphic(org.docx4j.dml.Graphic graphic) {
                this.graphic = graphic;
        }
       
        public Object getDocxObject() {
                return this.graphic;
        }
       
        public java.awt.Image getImage(WordprocessingMLPackage wmlPkg) {
               
                java.awt.Image theImage = null;
        byte[] bytes = BinaryPartAbstractImage.getImage(wmlPkg, graphic);
        if (bytes!=null) {
                theImage = Toolkit.getDefaultToolkit().createImage(bytes);             
                return theImage;
        } else {
                return null;
        }
        }

//      private org.docx4j.dml.Pic getPic() {
//              return this.graphic.getGraphicData().getPic();
//      }
}// Graphic class
 
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


You may also be interested in org.docx4all.swing.text.InlineImageView