Jump to content
JasperReports Library 7.0 is now available ×

How to make jasperReport work??


Recommended Posts

By: jelias3010 - jelias3010

How to make jasperReport work??

2006-04-21 13:57

Hi

i'm trying to make a report with jasperReport. i make my .xml template with iReport but i can't make it work in my web app.

i'm working with spring and struts.

My code is:

 

List projects = this.projectService.getAll();

 

File compiledReportFile = new File(this.globalParameterService

.getJasperDirectoryPath()

+ File.separator + "AllProjectsReport.jasper");

 

JasperPrint jasperPrint = JasperFillManager.fillReport(

compiledReportFile.getPath(), new HashMap(),

new JRBeanCollectionDataSource(projects));

 

JRXlsExporter xlsExporter = new JRXlsExporter();

 

xlsExporter

.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,

Boolean.FALSE);

 

xlsExporter.setParameter(JRXlsExporterParameter.JASPER_PRINT,

jasperPrint);

 

String outputReportFilePath = this.globalParameterService

.getTemporalDirectoryPath()

+ File.separator + "AllProjectsReport.xls";

 

xlsExporter.setParameter(JRXlsExporterParameter.OUTPUT_FILE_NAME,

outputReportFilePath);

 

xlsExporter.exportReport();

 

return outputReportFilePath;

 

can anybody tell me what i'm doing wrong.

 

thanks

(sorry for my english)jelias3010

 

 

 

 

By: Rafael - rafasanmartinez

RE: How to make jasperReport work??

2006-04-23 01:46

Elías,

 

There is no way to say what´s going wrong if you do not provide us what is both the effect that this code produces, and the error, if any, that it produces.

 

Rafael

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...