Monday, September 29, 2014

Row counting with JasperReport

JasperReport has simple way to count row in report. In this report I will tell about counting records from main and sub-report. I take for base report from "Using JavaBean datasource for report and subreport in iReport" article and add necessary changes for obtain next result:
Picture 1: Line numbering result.

Monday, September 15, 2014

Correct way to wrap text in iReport

Default behaviour of JasperReport with long string is cut by accord to element length. You can change this behaviour by set "Stretch With Overflow" to True.
Picture 1: Set property for wrap long string.

This solution will bring to ugly result: wrapped element will excel among all neighboring elements:

Picture 2: Not suitable wrap.
If such behaviour is not suitable you can fix it in simple way.

Friday, September 12, 2014

Summarize from subreports in JasperReport

One from typically reporting tasks is calculate aggregate operations: summarize, counting, averaging. JasperReport allow run this operation. But if you work with subreports you can meet with strange behavior. Below I will tell about one aggregate operations - calculating sums and pay attention upon not evident moments.

Main principle of summarizing is passing sum value from subreport to main report and accumulate it in accord value on main report. We can modify sample from previous article for get such result:
Picture1: Report with sums.

Monday, September 8, 2014

Runing JasperReport subreport from java code

In previous post I created JasperReport report with subreport and runned it from through iReport. But, I think, more interesting is way to run it from java code.