jasper ireport basic functionality - jasper-reports

I am new to JasperReports and iReport and I am sturggling to get the most basic example up and running. I'm trying to read input from a .xls file and put it into a table using iReport. Eventually, I want to read from a database, and transform the data in a meaningful way but for now I just want to view what I am reading and I can't get that going. First, if I just drag and drop my Field into the template, $F{Account}, I would expect to see the list of values for that field name (as I do when I preview my "query"). However, if that is all I do and then preview, I see the first account number in my input xls, and then 50 pages of empty white space. Why would this be?
Next, if I create a basic table, I am getting an error
Error filling print... null
java.lang.NullPointerException      at net.sf.jasperreports.components.table.util.TableUtil.isSortableAndFilterable(TableUtil.java:344)   ...
Print not filled. Try to use an EmptyDataSource...
Any help is greatly appreciated! Also, I should note, I did download JasperReports but I'm wondering if I need to somehow connect iReport to those classes. I saw a way to do it in the Netbeans plugin but I'm just trying to use the iReport GUI

The table component is great. But it's harder to use than it should be. Take a look at this Table Component tutorial to learn how to use it.
For the first part of your question you don't give enough information for anyone to know. My guess is that you put the field into the Title band rather than the Detail band.

Related

iTextSharp 5: Create image from text

I am using iTextSharp (C#) to generate a few PDF-reports.
One of them creates a bill. The bill must contain one line in OCR-B.
I cannot embed the font file.
Since im doing the new reports after the old ones, I went to check how it was done in the old bill-report. They inserted a picture.
Seems like a good workaround.
I have been googling on how to render text as image using iTextSharp, without success.
I am open for suggestions.
Apparently, there is no iTextSharp way of doing this.
This approach worked for me How to generate an image from text on fly at runtime
That way I didn't have to include any 3rd party libraries.

Can birt support reading html tables from database and displaying them dynamically to a pdf report file?

I have come across a scenario where I have to read html data from database and display it in pdf reports. This html data also contains table structure <table></table> tags and other html element inside it. Previously we used jasper reports for our reporting needs but recently as we came to know that the above functionality is not supported in jasper, I wanted to know which reporting tool can be used so that it can be incorporated with servoy. Does birt provide this functionality?
AFAIK none of the well-known reporting tools does support this, although in BIRT it works "somehow" - but not good enough to be usable.
The reason for this is simple, I think: A reporting tool would have to incorporate a complete browser engine like WebKit or others to achieve this, because it would have to "understand" the structure for its page-breaking algorithm.
Yes, BIRT has a text element where we can set the display type to HTML. If the html table is in a dataset field you will just have to include it in the expression of the text using "value-of" tag, something like this:
<VALUE-OF format="HTML">row["htmlTableField"]</VALUE-OF>
PDF format is taking such html elements into account, including most of simple style settings such background color, text-align, borders etc.
Usually the reports render just fine with html.
There are some tricks to displaying html correctly in BIRT.
You may use a Dynamic Text element and set to html or auto.
Here are some tricks to handling free form text..
Make sure your xml is valid, I recommend replacing line breaks or you may catch a scenario where the rptdocument will not export.
Also, if possible keep these in auto layout, when using run + render. The page breaks may actually be calculated once on run and again on render. You might experience breaking issues with fixed. The page may attempt to display all the html prior to breaking a page when using the RUN() phase, in web viewer or the rptdocument. Then when rendering to pdf the the breaks are applied differently, with fixed layout.

PDF to Jasper XML

I have a PDF file (softcopy) which was created using iText. Now my company decided to use JasperReports for new release. I need to use that PDF file (softcopy) and need to design JasperReports template and need to populate data.
Do we have any plugin in JasperReports that can convert from PDF to JasperReports JRXML or what do I need to do? Any suggestions?
A PDF is a description of how to render a document on a page. Things
like "draw a vertical line here", "write 'foo bar baz' here in
Courier". It does not contain any information about the format or
organisation of the stuff it is rendering. You won't be able to tell
that you're looking at a table, or a list of bullet points, or a
paragraph, or anything like that.
The PDF format does contain information on a page-by-page basis.
Therefore, page breaks are the one piece of format/organisation
information that you can find.
If you want anything more than a raw stream of completely unformatted,
disorganised text, one per page, you are out of luck. It's virtually
impossible.
from javaranch
You can use http://xmlprinter.com/ and then use a xslt to transform the resulted xml to the desired jrxml.
I'm working in it. If I finish it, i will post the result on github or any other public and open place.
Good Luck

ReportSize in Excel not the same as in PDF

I have done already a lot of small (and also bigger reports) with report viewer 2010. In most cases I give the user the possibility to select the destination-format (PDF, Excel and sometimes also word).
However I always encouter the problem that the page format settings are applied different in the different output formats: If I create a report and optimize it to PDF, set the page size and the borders, then design the report, the report looks good (Measures are correct, borders are correct). However if I export it to Excel, it always is to big. What in PDF gives me one page, is in excel on two pages (horizontally).
I checked the page borders in excel because I have read that there was a bug in an ancient report viewer with this, but they are exactly as specified in the reports properties. The paper size is also correct.
I also have set the report width over the properties grid (via F4) to PageWidth-LeftBorder-RightBorder, but this is the same.
I have also played around with the InteractiveSize, but this seems not to have an influence.
Is there something special to know about Excel-Exports from report viewer or is there a known bug? Has someone a solution for this behaviour?
It seems to me that in excel the same page format has half an inch less size than in pdf. Up to now I was never be able to create an exact copy of some paper report template. In the end, it was always something like making handicraft work, but I don't like that. I would like to understand whats going on.
As an additional information, I specify all metrics in centimeter, may be there is a problem with that? And the office is office 2010.
A real solution to this problem I have not found. Maybe this connect entry promises somethin for the future:
http://connect.microsoft.com/VisualStudio/feedback/details/636407/rdlc-excel-export-margin-problem#

create jrxml file at run time and modify at run time

I have a requirement to develop custom reports where we already have some reoprts developed using JasperReports using iReport tool. Now the requirement is to modify those reports design at run time. I should use those existing jrxml files and save as to new report then change the design at run time. Also I should see those newly created reports whenever I want.
I have gone through the Jasper API and Dynamic Reports where we can create the reports dynamically at run time but we can't save the design (like JRXML).
I am looking for any other JRXML design API to create and modify and save the Jasper Reports at run time.
I appreciate if any one can help me.
Thanks in Advance
Srinivas
It seems DynamicJasper can do this.
First thing you will need to draw a flow chart of how you want to do things.
For example, if the report already exists, and you want it as is, what will you do?
In case you want to modify it a little, do you want to save as jrxml and compile each time?
Or do you want to compile to jasper, store on local storage then populate later.
It seems you want to build a reporting engine and answering all those questions is basic. In that case here is something to start from.
Find a factory called DocumentBuilderFactory which will help you parse the XML into DOM object, modify then save it.
Here is a good tutorial on using it