Jump to content
JasperReports Library 7.0 is now available ×

URGENT HELP with filling and viewing report


Recommended Posts

By: Kobus Ehlers - comlink

URGENT HELP with filling and viewing report

2003-07-19 04:50

Hi All

 

I have spent a lot of time creating all sorts of reports for my computer studies assignment in iReport. Everthing works perfectly when I run it there, but I need to call these reports from my application.

 

I would only like to show it in the JasperViewer for now, but I cannot get the code right. Does anyone perhaps have some sample code. Also which classes I need to import. I have already compiled the reports and only need to fill and show them.

 

If anyone is willing to give me their e-mail address so I can contact them for help I would be forever thankfull.

 

This is an emergency seeing that I have to hand in the project in one week!!!

 

HELP!!

 

Thanks, Comlink

 

 

 

 

By: Ryan Johnson - delscovich

RE: URGENT HELP with filling and viewing report

2003-07-19 16:00

To load the .jasper file:

 

JasperReport template = JasperManager.loadReport(new FileInputStream(...));

 

To fill the report, first you need an instance of JRDataSource and a Map (possibly empty) of any params you use. Then:

 

JasperPrint report = JasperManager.fillReport(template, params, datasource);

 

To show the reoprt, create a JRViewer and stick it in a dialog:

 

JRViewer jrv = new JRViewer(report);

JDialog viewer = new JDialog(...);

viewer.setTitle(...);

viewer.getContentPane().add(jrv);

viewer.pack();

viewer.show();

jrv.clear();

viewer.dispose();

 

That should do it!

Ryan

 

 

 

 

By: Kobus Ehlers - comlink

RE: URGENT HELP with filling and viewing report

2003-07-20 02:47

Hi Ryan

 

Thanks a lot for your effort. I have another problem though.

 

When I try to run the code you have given me, I get an error message saying that java.util.HashMap was not found. (Eventhough I have import java.util.*) Could you perhaps tell me which classes I need to import?

 

Would you mind if I e-mailed you directly?

 

Hope to hear from you soon.

 

Regs,

 

C

 

 

 

 

By: Kobus Ehlers - comlink

RE: URGENT HELP with filling and viewing report

2003-07-20 03:18

Sorry man - that was trouble with my windows JVM. Fixed it now...

 

I am still not sure which classes to import now though. Please help here.

 

 

 

 

By: Ryan Johnson - delscovich

RE: URGENT HELP with filling and viewing report

2003-07-21 09:59

Here you go:

 

import dori.jasper.engine.*; // JasperManager, JasperReport and the datasources

import dori.jasper.view.JRViewer;

import javax.swing.JDialog;

 

Ryan

 

 

 

 

By: Kobus Ehlers - comlink

RE: URGENT HELP with filling and viewing report

2003-07-21 10:45

I have done that but I still get an error.

 

I need to display and print some reports I have compiled in iReport. They work just fine when I try to run it in the iReport GUI, but as soon as I enter the code in my program I get exceptions. I get an exception saying: “Type com.lowagie.text.Document was not found.” Or “Could not find package named .orgxmlsax”

 

I hope you can help here. Im getting dangerously close to my deadline!!!

 

Regs,

 

C

 

 

 

 

By: Teodor Danciu - teodord

RE: URGENT HELP with filling and viewing report

2003-07-21 11:53

 

Hi,

 

You need to place all the required libraries into

the classpath when you use JasperReports.

You can find them under the /lib directory

of the distributed package.

Also take a look at the "Requirements" page in the

documenatation.

 

The errors you mentioned simply say that iText

is missing from your classpath and that no XML parser was found.

 

I hope this helps.

Teodor

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...