aspose file tools*
The moose likes Other Open Source Projects and the fly likes Need help writing Jasper report by hand with Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Need help writing Jasper report by hand with Java" Watch "Need help writing Jasper report by hand with Java" New topic
Author

Need help writing Jasper report by hand with Java

Anne M Crace
Greenhorn

Joined: Aug 07, 2013
Posts: 7
Is anybody experienced with Jasper reports? I have a Swing GUI with a JTable and the user can choose the columns they want displayed at runtime. I am passing a DefaultTableModel through my application. I was able to get my report to work when I generated it in iReport with COLUMN_0, COLUMN_1, etc. but it would only display when all the columns were selected. I believe I need to generate the .jasper file manually with JasperReports API. I am able to generate the .jasper file and decompile it with iReport but the first problem I am having is all of the fields I am passing in aren't being generated. The other problem is I need to associate the JRDesignTextFields with the Fields. I'm sure I'm going to have other problems (the commented out lines near the bottom blow up). Anyhow, any help would be appreciated. I am using version 4.7.1 of iReport and Jasper Reports so I don't have quite the latest version. Here is my Java code:
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1031
    
    5

What happens when you execute the commented out lines? Can you post the entire stack trace of any exception?
Anne M Crace
Greenhorn

Joined: Aug 07, 2013
Posts: 7
Here's the stack trace. The last line starts my Swing code so that and anything after is probably irrelevant.
java.lang.ClassCastException: net.sf.jasperreports.engine.fill.JRFillFrame cannot be cast to net.sf.jasperreports.engine.fill.JRFillElementGroup
at net.sf.jasperreports.engine.fill.JRFillElement.<init>(JRFillElement.java:166)
at net.sf.jasperreports.engine.fill.JRFillTextElement.<init>(JRFillTextElement.java:99)
at net.sf.jasperreports.engine.fill.JRFillStaticText.<init>(JRFillStaticText.java:50)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitStaticText(JRFillObjectFactory.java:636)
at net.sf.jasperreports.engine.base.JRBaseStaticText.visit(JRBaseStaticText.java:95)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:89)
at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:82)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88)
at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:88)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:496)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:430)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:569)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:915)
at DTP_utils.PrintRoster.testPrint(PrintRoster.java:162)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help writing Jasper report by hand with Java