Hi,

 

First, it is always better not to compile a file in the application.

It is prudent to use jasper file. In that case u just needs to use JRLoader.loadObject (“jasper file”).

 

One more thing is one need to use custom datasource class to get the result set at one shot.

Reason is result set doesn’t get all the data at one shot. It comes in chunks and so the print object too builds incrementally.

 

At the last u needs to flush and close all the streams.

outputfile.flush ()

outputfile.close ()

 

Hope this’ll help.

 

Regards,

Asit Patadia.

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of girija subudhi
Sent: Tuesday, September 12, 2006 10:25 AM
To: jasperreports-questions@lists.sourceforge.net
Subject: [jasperreports-questions] problem with out of memory exception

 

Hi ,

 

   In my project i have a requiremt in generating report in Excel format.

 

But when i am integrating my .jrxml files with my program, its throwing me out of memory exception. For small data the reports are generating properly.

But for large datas its throwing me exception. If anybody can help me regarding this, then it will be a great help. I am also sending the code.

 

JasperDesign jasperDesign = JasperManager.loadXmlDesign(strPath+"report\\newmember\\newmember_landscape.jrxml");
    JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
    java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
    for(int i=0;i<siteName.length;i++)
    {
     java.io.OutputStream outputfile= new java.io.FileOutputStream(new java.io.File(strPath+"report\\newmember\\newMemberList.xls"));
     Map parameters = new HashMap();
     parameters.put("fromDt",printForm..getFromDt());
     parameters.put("toDt",printForm.getToDt());
     parameters.put("siteCode",siteName[i]);     
     JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conClp);
     JRXlsExporter exporterXLS = new JRXlsExporter();
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.OUTPUT_STREAM, output);
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.IS_AUTO_DETECT_CELL_TYPE, Boolean.FALSE);
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE);
     exporterXLS.setParameter(net.sf.jasperreportsengine.export.JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
     exporterXLS.exportReport();
     outputfile.write(output.toByteArray());

 

 

Regards

Girija

 


Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW


The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.

www.aztecsoft.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to