vargheseps4u Posted June 18, 2013 Share Posted June 18, 2013 Hi, I am trying to add an image into my exel report. I tried this but no success. can any one help meHere is the code am using and jrxm.--------------------------------------- jrxml ----------------------------------------------------------------- <jasperReportname="testImage"columnCount="1"printOrder="Vertical"orientation="Portrait"pageWidth="595"pageHeight="842"columnWidth="535"columnSpacing="0"leftMargin="30"rightMargin="30"topMargin="20"bottomMargin="20"whenNoDataType="NoPages"isTitleNewPage="false"isSummaryNewPage="false"><property name="ireport.scriptlethandling" value="2" /><property name="ireport.encoding" value="UTF-8" /><import value="java.util.*" /><import value="net.sf.jasperreports.engine.*" /><import value="net.sf.jasperreports.engine.data.*" /> <parameter name="chartInfoImg" isForPrompting="false" class="java.io.InputStream"/> <background><band height="0" isSplitAllowed="true" ></band></background><title><band height="50" isSplitAllowed="true" ></band></title><pageHeader><band height="50" isSplitAllowed="true" ></band></pageHeader><columnHeader><band height="30" isSplitAllowed="true" ></band></columnHeader><detail><band height="100" isSplitAllowed="true" ><image onErrorType="Icon" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" ><reportElementx="70"y="7"width="308"height="88"key="image-1"/><box></box><graphicElement stretchType="NoStretch"/><imageExpression class="java.io.InputStream"><![CDATA[$P{chartInfoImg}]]></imageExpression></image></band></detail><columnFooter><band height="30" isSplitAllowed="true" ></band></columnFooter><pageFooter><band height="50" isSplitAllowed="true" ></band></pageFooter><lastPageFooter><band height="50" isSplitAllowed="true" ></band></lastPageFooter><summary><band height="50" isSplitAllowed="true" ></band></summary></jasperReport>--------------------------------------------------------------------------------------------------------====================== java code =========================================HashMap jasperParameter = new HashMap(); File f = new File("f://yourImage.jpg"); FileInputStream fi = new FileInputStream(f); jasperParameter.put("chartInfoImg", fi); JasperReport jasperReport = JasperCompileManager.compileReport("f://testImage.jrxml"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter, new JREmptyDataSource()); JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "F://simplereport1.xls" ); exporter.exportReport();=======================================================================Thanks in advance Link to comment Share on other sites More sharing options...
Solution ajinkya_c Posted June 18, 2013 Solution Share Posted June 18, 2013 Hi,Which version of jaspersoft you are using, I think earlier version not support this feature.Regards,Ajinkya Link to comment Share on other sites More sharing options...
vargheseps4u Posted June 18, 2013 Author Share Posted June 18, 2013 Hai i have now downloded jasperreports-5.1.2-project and i still face the same problem.Thanks in advance Link to comment Share on other sites More sharing options...
vargheseps4u Posted June 18, 2013 Author Share Posted June 18, 2013 Hai i have now downloded jasperreports-5.1.2-project and i still face the same problem. Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now