By: ccatindia - ccatindia
How can I call Jasper Report file from swing
2003-12-11 01:10
We are the peoples involved in one swing application project.We are using jasper reports
for reporting purpose.We didn't how to call jasper report from our application.So please give some example coidings for calling the report with parameter passing.
Thanking you.
CCAT
By: Carlos Costa e Silva - carloscs
RE: How can I call Jasper Report file from swing
2003-12-11 04:57
Look in demosamplesjasperJasperApp.java for an example.
By: Alexander Wallace - aows
RE: How can I call Jasper Report file from swing
2003-12-11 11:06
something like this will show the jasper viewer:
public static void viewReport(JasperPrint jp) {
try {
if (jp != null)
JasperViewer.viewReport(jp, false);
}
catch (Exception e) {
}
}
you need to create a jasper print object and pass it to that method... No much sense in making an example of that since there is way too many different ways of filling up reports... It's easier if you check demo/samples/datasource example that comes with the source for jasper reports.
To pass parameters to a jasper reports you just create a hash map, put parameter keys and values in and then pass it to the jasperFillManager like:
Map parameters = new HashMap();
parameters.put("reportWhereClause", 'WHERE ID >0");
jp = JasperFillManager.fillReport(ClassLoader.class.getResourceAsStrea\
m("/com/whatever/swing/reports/AReport.jasper"), parameters, cn);
Hope this helps... but check the examples in the demo/samples directory, they have all you need...
How can I call Jasper Report file from swing
2003-12-11 01:10
We are the peoples involved in one swing application project.We are using jasper reports
for reporting purpose.We didn't how to call jasper report from our application.So please give some example coidings for calling the report with parameter passing.
Thanking you.
CCAT
By: Carlos Costa e Silva - carloscs
RE: How can I call Jasper Report file from swing
2003-12-11 04:57
Look in demosamplesjasperJasperApp.java for an example.
By: Alexander Wallace - aows
RE: How can I call Jasper Report file from swing
2003-12-11 11:06
something like this will show the jasper viewer:
public static void viewReport(JasperPrint jp) {
try {
if (jp != null)
JasperViewer.viewReport(jp, false);
}
catch (Exception e) {
}
}
you need to create a jasper print object and pass it to that method... No much sense in making an example of that since there is way too many different ways of filling up reports... It's easier if you check demo/samples/datasource example that comes with the source for jasper reports.
To pass parameters to a jasper reports you just create a hash map, put parameter keys and values in and then pass it to the jasperFillManager like:
Map parameters = new HashMap();
parameters.put("reportWhereClause", 'WHERE ID >0");
jp = JasperFillManager.fillReport(ClassLoader.class.getResourceAsStrea\
m("/com/whatever/swing/reports/AReport.jasper"), parameters, cn);
Hope this helps... but check the examples in the demo/samples directory, they have all you need...
0 Answers:
No answers yet