problem in inserting images to excel sheet
2003-11-19 02:18
Hi,
I am generating microsoft excel sheets using japser reports
I am required to insert image in excel. I am going so by
<image scaleImage="RetainShape" hAlign="Center" vAlign="Top">
<reportElement x="0" y="10" width="700" height="355"/>
<imageExpression>"abc.jpg"</imageExpression>
</image>
But nothing is getting inserted in the excel sheet.
Can anybody help me out.
Thanks
Deepak
By: Teodor Danciu - teodord
RE: problem in inserting images to excel shee
2003-11-29 00:16
Hi,
Images are not supported by the POI library we use
to generate XLS content.
Thank you,
Teodor
3 Answers:
I am not using JRXML file rather just creating my design using java APIs only. But i am not able to get the picture in Excel sheet. Please help me on the code urgently.
JRDesignBand bandDetail = new JRDesignBand();
bandDetail.setHeight(fontMetric.getHeight() + 1);
bandDetail.setSplitAllowed(false);
JRDesignImage image = new JRDesignImage(jasperDesign);
image.setScaleImage(JRImage.SCALE_IMAGE_CLIP);
JRDesignExpression jrExpress = new JRDesignExpression();
JRDesignExpressionChunk expressChunk = new JRDesignExpressionChunk();
String str = "http://www.google.de/intl/de_de/images/logo.gif";
expressChunk.setText("\""+str+"\"");
jrExpress.addChunk(expressChunk);
jrExpress.setValueClass(String.class);
image.setExpression(jrExpress);
bandDetail.addElement(image);
Regards
~Aman
Try this Excel API which inserts image in your excel document using java language and you can also use other language to insert any feature in your excel file using this API.