POI does not support image inclusion in Excel files, so you can't use it
for this purpose. There is a far better API for managing Excel
spreadsheets in Java called JExcelApi. See
http://jexcelapi.sourceforge.net/. Generally JExcelAPI is far more
efficient and straightforward than POI. The WriteableImage class in
there makes image writing simple and easy, for example:

WritableImage wi= new WritableImage(imagecol, imagerow, imagewidth,
imageheight, new File(params.IMAGESFILE()));
writeSheet.addImage(wi);

good luck.


[EMAIL PROTECTED] wrote:

>Dear all
>    Does anyone can insert an image into a excel file?
>I use the quick guide in hssf help as my program code..but it not work!
>It can generate a excel successfully, but an empty content..
>When I close this file, excel will alert unexpect error..
>Anyone can help me to solve this issue.......  
>
>
>    a = new HSSFClientAnchor( 0, 0, 1023, 255, (short) 1, 0, (short) 1, 0 );
>    group = patriarch.createGroup( a );
>    group.setCoordinates( 0, 0, 80 * 4 , 12 * 23  );
>    float verticalPointsPerPixel = a.getAnchorHeightInPoints(sheet) / 
> (float)Math.abs(group.getY2() - group.getY1());
>    g = new EscherGraphics( group, wb, Color.black, verticalPointsPerPixel );
>    g2d = new EscherGraphics2d( g );
>    g2d.drawimage(image, ...............)     //image object is created by 
> java.awt
>
>
>Joan
>
>  
>

Reply via email to