tags:

views:

1232

answers:

2

Hi,

I am working on a java web application where i have to show an image on excel file. i used the java file iopo to write the image to the excel file.

Issue is when the user mail this to client the image does not show up

Is there any way to embed the image into the excel file using java with/without using any external API.

Thanks & Regards Rishi

A: 

You must use an external library as there is no standard Excel API for Java.

You should use something along the lines of JExcelAPI.

Yuval A
A: 

You can use Apache POI: http://poi.apache.org

See especially http://poi.apache.org/spreadsheet/quick-guide.html#Images

Turismo
Is there no option then using external API's
For webapps I don't know of any other way other than using external APIs. If you are on a client were Excel is installed you probably also can use COM automation.
Turismo
POI must be doing that only ..using the ByteArrayOutputStream to write the bytes into excel cellwhereas my java code also does that . It should work as well.
The Excel file format is very complicated. Several records in the format have to be adapted for this to work. If you take a closer look at the POI example you will see that they did a lot more than just writing the bytes into the Excel file.
Turismo