Merging Rows of a table
Posted on September 19, 2011 at 6:59am
I'm a newbie to jasper reports. Just started looking into it two days back. :)
I'm trying to merge cells of a table. For example: cells with same same values will be merged. Currently I'm getting the border lines for each cell. I want these cell to be merged similar to the attachment that I have attached. Would appreciate if someone would guide me in the right path.
Thanks in advance.
Post Edited by charanraj at 09/19/2011 13:59
Posted on September 19, 2011 at 11:53pm
There is no way of the decision of this problem :(
Try uncheck option "Print repeated values" on first field, but this field will be displayed only on the first row (not in middle)
Posted on September 20, 2011 at 6:47am
Sad :( Currently I'm using with "Print repeated values" unchecked. But in excel the cell borders are visible. Is there any work around for this?
Thanks in advance
Posted on September 21, 2011 at 3:39am
I make subreport with all fields (excluding first field). First field and subreport placed into frame with displayed borders. First field haven't borders.
In result of execution report, first field displayed with borders of the frame (borders not in every row for first field).
Sorry for bad english
Posted on September 21, 2011 at 5:17am
Sorry, i am forget that in the case of using subreport you may solve your problem by setting "Stretch type" for first field with "Relative to Band Height".
Posted on September 21, 2011 at 6:28am
Thank you very much sanbez :)
Now I'm facing another issue, say i have 3 unique records in the first field and 10 records in the subreport. I have placed the first field and subreport inside a frame and placed this frame inside the detail of main report. The output I'm getting is complete frame is repeated 10 times. I have unchecked the "Print Repeated Values". Still the complete frame is repeated 10 times :( any solution?
Thanks in advance.
Post Edited by charanraj at 09/21/2011 13:35
Posted on September 21, 2011 at 7:51am
It is strange behavour. But probably I was too short in the explanations.
I writing in iReport by using java-collections. In this case i do next steps:
1. Define java-class for the storage of result my calculations. For example:
private String FirstColumnValue;
private String SecondColumn;
private String ThirdColumn;
and so on
2. Writing java-code for search data. In this code i fill my structure:
Collections<FirstColumnInfo> resultComputing = findCollection();
3. Creating DataSource and filling JasperReport:
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(resultComputing);
4. Filling Report:
JasperFillManager.fillReport("report.jasper", reportParametrs, dataSource)
... and so on (some actions for subreport)
If you are use SQL-query as data source for report, i think that you must to do two query (1. for main report and 2. for subreport):
1. select distinct(first column) from (yuor query)
2. For subreport you must define parameter: firstColumn
and query for subreport (select * from (your query) where first_column=Parameter)
It is very bad by productivity, but i think you may find optimal queries for both reports (main and subreport).
Posted on September 22, 2011 at 5:20am
Thanks sanbez for the steps. You always rock. It was really helpful :)
I'm trying to export report in xls format and there are lot of empty cells which drags the page longer. Is there a way to stop it? I tried "Relative to Band Height" & "Relative to Tallest Object" but it dint solve the issue.
Thanks in advance.
Posted on June 14, 2013 at 4:01am
HI,i wanted to do in tables.....if repeated values are there then they should be merged.Can anyone help me
Posted on August 14, 2014 at 3:14pm
Have the same problem - merge cells by rows for same values. Maybe it is a good idea to have some grouping/merging function for column in table component.