Home

News: Getting Started With JasperReports

  1. Getting Started With JasperReports (18 messages)

    JasperReports is a very popular open source (LGPL) reporting library written in Java. Unfortunately it is not very well documented and I had a hard time coming up with a simple report. After some research, I was able to generate a simple report. This article summarizes what I found needed to be done to get started with JasperReports.

    A short excerpt:
    JasperReports' reports are defined in XML files, which by convention have an extension of jrxml. A typical jrxml file contains the following elements:
    • <jasperReport> - the root element.
    • <title> - its contents are printed only once at the beginning of the report
    • <pageHeader> - its contents are printed at the beginning of every page in the report.
    • <detail> - contains the body of the report.
    • <pageFooter> - its contents are printed at the bottom of every page in the report.
    • <band> - defines a report section, all of the above elements contain a band element as its only child element.
    All of the elements are optional, except for the root jasperReport element.

    Threaded Messages (18)

  2. Documentation[ Go to top ]

    They have an ebook 'The JasperReports Ultimate Guide' which
    you can purchase. Back when I was using Jasper I seem to
    remember that as being very useful.

    Here is its table of contents:
    http://jasperreports.sourceforge.net/guide/index.html

    Hani
  3. Lame article[ Go to top ]

    Re: David R. Heffelinger's Ensode.net - Getting Started With JasperReports. What a lame 'Hello World'. God forbid you included the necessary import & class path info so I can actually compile & run the damn thing? The point of a simple hello world example is to get something up & running quickly *without* having to read the entire manual just to get something to compile. Two thumbs down on this article.
  4. re: Lame article[ Go to top ]

    Here's your 'Getting Started With JasperReports' article with the missing pieces filled in to save people some headaches of trying to run a simple hello world & running into a bunch of ClassNotFound errors because the author couldn't be bothered to actually make his short example a short, self contained, compilable example: // java -cp .;jasperreports-3.7.0.jar;commons-digester-1.7.jar;commons-logging-1.0.4.jar;commons-collections-2.1.1.jar;commons-beanutils-1.8.0.jar;iText-2.1.0.jar JasperReportsIntro import net.sf.jasperreports.engine.*; import java.util.*; public class JasperReportsIntro { public static void main(String[] args) { JasperReport jasperReport; JasperPrint jasperPrint; try { jasperReport = JasperCompileManager.compileReport("reports/jasperreports_demo.jrxml"); jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, "reports/simple_report.pdf"); } catch(JRException e) { e.printStackTrace(); } } }
  5. Digester Error[ Go to top ]

    java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

     

    Can anyone please Help me with this error. It has made me not use my jasperreport in my program.

    the code i use to generate the report is:

            HashMap map = new HashMap();
            Connection con = new connect().odbcConnect();
            String reportFile = "E://Projects//NetBeansProjects//kusda//src//kusda//members.jrxml";
            try {
                JasperDesign jasperDesign = JRXmlLoader.load(reportFile); 
                JasperReport report = JasperCompileManager.compileReport(jasperDesign);
                JasperPrint print = JasperFillManager.fillReport(report, map, con);
                JasperViewer.viewReport(print);
            } catch (Exception ex) {
                ex.printStackTrace();
            }

    from my tracing i get the source of the error isthis line:

    JasperDesign jasperDesign = JRXmlLoader.load(reportFile);

    Can anyone debug this please?

  6. I found I learned more from the examples in the demo directory that's in the JR distribution than from anything else. Also, go to http://www.hibernate.org/79.html for Hibernate integration.
  7. I started playing around with JasperReports couple of weeks ago and found that documentation very limited. Then I discovered Eclipse B.I.R.T., and I tell you it kicks ass and takes no prisoners. It's much easier to use, documentation is plenty and the fact that I don't have to compile the reports (as I do in JasperReports) makes B.I.R.T. really stand out. B.I.R.T. is at version 1.1 right now, but Eclipse will be realising 2.0 in October and will have some nice new features. Check it out: http://eclipse.org/birt/

    Alex
  8. I started playing around with JasperReports couple of weeks ago and found that documentation very limited.

    It sounds like you took a look at JasperReports during the short period where the docs were unavailable. JasperReports has had some major features added over the last year, and the docs had lagged behind. We recently rewrote the entire guide and made it available a few weeks ago. The new guide covers every feature in JasperReports and has been well received by the community. In addition, JasperReports comes with a much richer set of sample reports and sample code than BIRT, which many developers find very useful.

    I suggest taking another look at JasperReports. Among other nice features missing in BIRT is better control over when page breaks happen, which is often a requirement for printed reports.

    -Barry Klawans
  9. For those who are lucky and not ‘Eclipse’d there is iReport standalone report designer (http://kgionline.com/presentations/ireport/ireportDemo.jsp ) for JasperReports.

    My little flash tutorial is here: http://kgionline.com/presentations/ireport/ireportDemo.jsp
  10. I tried and used the version 0.6 (and before) and it was a great tool for creating, viewing and exports reports inside java applications. But it lacks some important features like grouping functions based on sub-groups values NOT details values (grouping on details values works fine).
    I asked many times Teodor (jasper report's creator) about that isssue (grouping based on sub-group values) and gave some workarounds but did not work too.
    I found that runtime engine api is not mature too.
    This was experience with jaserreport and I hope the last version fixes those NEEDED functions.
  11. From the JasperReports-Homepage: "JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files."

    However there's a popular format missing: Word/DOC. And the big plus of this format is that the customers like it because they can edit the reports in their installed office suite. What is the best way to generate reports in Word/DOC format? Is there even a way to do it? What are your best practices?

    Thanks in advance for your replies.
  12. From the JasperReports-Homepage: "JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files."However there's a popular format missing: Word/DOC. And the big plus of this format is that the customers like it because they can edit the reports in their installed office suite. What is the best way to generate reports in Word/DOC format? Is there even a way to do it? What are your best practices? Thanks in advance for your replies.

    Although not exactly what you are asking, JasperReports is able to export to Rich Text Format (RTF). RTF is readable by MS Word and virtually every word processor out there.

    see http://jasperreports.sourceforge.net/what.new.html#new5
  13. However there's a popular format missing: Word/DOC.

    From what I understand, the newest version(s) of Word use XML files. Theoretically, you could generate the XML for a Word document.
  14. The current version of office has OK support for XML, but you really need the "Professional" version to get good support. I've yet to talk to anybody using the Pro version of Office 2003, and in fact most of the people I talk to are using Office 2000 or the Mac version, neither of which support XML, but both of which support RTF.

    The next version of Office is going to support a native XML format for all documents, and Microsoft is going to being publishing the schemas before the release. (They may have already published them - I haven't checked recently.) There will still be a long lag time until its safe to say everybody has upgraded.

    Finally, OpenOffice has prososed an XML format called Oasis for use in its application suite. A few independed developers are working on an Oasis exporter for JasperReports which will get rolled into a future release.

    -Barry Klawans
    Chief Technical Officer
    JasperSoft
  15. What's wrong with generating an XHTML report and simply reading that into Word, you can even take an HTML document and rename it to a ".doc".

    Make Microsoft do the the work, just stick to the standards.

    -John-
  16. Using Aspose.Words for JasperReports, it is possible generating reports from JasperReports to Word document (DOC), Office Open XML (OOXML, DOCX), Web page (HTML) and plain text (TXT) formats. It is written purely in Java and is provided as a single JAR file that can easily be deployed on the machines running JasperReports or JasperServer. Aspose.Words for JasperReports exports flow layout documents that are easy to further edit in Microsoft Word, if necessary.
  17. Check out this article. Has some good explanation of the various aspects of Jasper Reports. Also links to good tutorials. Information about cross-tab reports is provided. Also details of the various GUI tools to generate Jasper Reports are also given.

    http://www.tsproviders.com/techytrends/mvnforum/viewthread?thread=240

    -AJ
  18. I don't get it[ Go to top ]

    I played a little with IReport and my conclusion is: Commeon! It takes a lot to design a medium-sophisticated report, you have to do "subreports" and all kind of mind tricks stuff. I am a java gui, but it took me less than 2 hours to do a complete report in .Net (either with Crystal Reports or with Microsoft Report Viewer) with all the panache involved. It was fast, looking good, I was in control of stuff, I didn't have to learn anything. Not that .Net is a silver bullet, but a report doesn't have to be rocket science (au contraire). I'd rather pay the money and make big savings on my precious time.
  19. I don't get it - take 2[ Go to top ]

    Here's a quote from http://jasperreports.sourceforge.net/tips.tricks.html: If one dummy group is not sufficient for you and you have a giant detail band, you could introduce as many dummy groups as you want to, all of them with the same dummy expression. The whole tips'n'tricks stuff there is delicous. Obesrvation: dummy seems to be Jasper's second nature. Another one: But there is no such "page break" element available in JasperReports, so what to do? Answer: Run like hell