Jasper Reports 6: Extra Space between fields [duplicate] - jasper-reports

This question already has answers here:
How to remove extra space between rows in JasperReports?
(1 answer)
Jaspersoft : Extra space at the end of table in detail band
(1 answer)
iReport (JasperReports) extra row issue
(2 answers)
Closed 1 year ago.
I am working on Jasper report, which has page header with multiple detail bands.
Page Header has headers for my report and then detail band has field row wise.
But when report is generated there is extra space between rows.
For eg:- Row1 -- Data1 Data2 Data3 (From Detail band 1)
(Space)
(Space)
Row2 -- Data1 Data2 Data3 (From Detail band 2)
Don't need this space between rows. Any solution for this?
Thanks

This might help you:
Set Jaspersoft Studio properties for "Text field" or "Static text" as follows:
Line spacing for Proportional
Line Spacing Size to 0.4 (or similar)
XML Should be:
<textElement>
<font fontName="Courier"/>
<paragraph lineSpacing="Proportional" lineSpacingSize="0.4"/>
</textElement>

Related

Jasper Report - Text being truncated when column does not have enough size [duplicate]

This question already has answers here:
Stretch overflow not working in excel jasper report
(3 answers)
How can I have long text in a single line excel cell?
(2 answers)
JasperReports export to excel auto size columns
(1 answer)
Closed 4 years ago.
I am doing a Jasper Report to generate excel via JasperSoft Studio 6.6.0.
I am encounter the issue where the text is not display in full when the column has not enough space. The text is being truncated.
The text should be: AAAAA,BBBBB,CCCCC,DDDDD,EEEEE,FFFFF,GGGGG,HHHHH
Please guide on this.

How to create grouped Cross Table in Jasper reports in different excel tabs?

What I have is single cross table shown below whose data is coming from a sub data set.
I would like to split this cross table on the basis of column1 and want something of this sort.
Further, I would like to export these tables in different excel tabs. May be by dynamically adding page break between them (Still figuring out how to do that as well).Name of these tabs has to based on Column1 i:e type1, type2, type3 etc. How do I dynamically set those names.Lastly, I also have to add this report to a another main report as sub report. Keeping all this in mind. Any help on how do I achieve this sort of format?
After struggling alot I was able to do it in this way.
Use report Dataset(main) for the crosstab.
Create group on Column1. Add footer for it.Remove all other band if you don't want them.
Put the break then Crosstab then a dummy Label as shown in the group footer.
4.Use it as subreport in different report.
Important Explanations:
Label is basically for naming the exported tab in excel.
<staticText>
<reportElement x="0" y="4002" width="100" height="20" uuid="392f134e-746d-46bf-8895-ecb403d54211">
<propertyExpression name="net.sf.jasperreports.export.xls.sheet.name"><![CDATA[$F{COLUMN1}]]></propertyExpression>
</reportElement>
<text><![CDATA[]]></text>
</staticText>
Here i utilized the dynamic property expression to name the sheet dynamically and Break to split the sheet in different tab on group to group the data based on column1.

How to sum BigDecimal Field in group of JasperReports report? [duplicate]

This question already has answers here:
How to sum all values in a column in Jaspersoft iReport Designer?
(2 answers)
Closed 4 years ago.
I need to do a high precision sum in a footer of JasperReports's report. Usually if you have a Double field you can drag and drop the field in the footer group and a popup window will be show displaying what kind of calculation do you what, sum for example. But if you have a BigDecimal field this popup window does not show.
So how can I sum BigDecimal Field in a (footer) group of report?
Just go the manual way.
Add a variable
Give it a meaningful name
Change the type to java.math.BigDecimal
Set the Calculation to the type you need, Sum in your example
Add the variable to a text field or add it with drag and drop to the report
Set your desired Evaluation time

Conditional Printing for Front and Back page

I'm using iReport 5.2.0 and I have 2 reports that I want to print.
Both reports contain dynamic data and can be of multiple pages. However, number of pages of first report is always equal to number of pages in second report.
In my current setup, the first report is always printed completely and then all the pages of the second report are printed.
However, my requirement is that the report should print in the following sequence:
Page 1 of Report 1.
Page 1 of Report 2.
Page 2 of Report 1.
Page 2 of Report 2.
Page 3 of Report 1.
Page 3 of Report 2.
...
Is there any way I could achieve this with JasperReports?
Lets say , report 1 uses X query with X_SQL and report 2 uses Y query with Y_SQL.
If both of the query has same number of column then it is great otherwise add additional column with respect to X_SQL and Y_SQL in order to union both query.
Remember you have to generate one number series column and one dummy column in your sql. You can generate number series dynamically in your sql.
X_SQL with two new column (number_series,'detail1'as dummy)
union
Y_SQL with two new column (number_series,'detail2'as dummy)
order by number_series, dummy
OUTPUT of SQL:
X_SQL column , 1 as number_series, 'detail1' as dummy
Y_SQL column , 1 as number_series, 'detail2' as dummy
X_SQL column , 2 as number_series, 'detail1' as dummy
Y_SQL column , 2 as number_series, 'detail2' as dummy
Now add two detail band in your new report. Height of report is only one detail band height + top and bottom padding.
1 detail band = first report design
2 detail band = second report design
U can use subreport if your jrxml is too complex.
Now in print when expression of detail band use
detail band 1 : $F{dummy}.equals('detail1')
detail band 2 : $F{dummy}.equals('detail2')
Note:
1) you need to order by in your sql query.
2) height of report need to choose properly.
If still you are having issue then i suggest to post your jrxml.

Ireport 4.0.2 band layout multiple column headers and footers

Is it possible in Ireport to have a band layout like the one below without using subreport? Or is there any other workaround. I tried to use subreport but unfortunately I cannot solve my issue. These have separate queries and I use php to fill in data to each details. Please help me.
Column Header 1
Detail 1
Column Footer 1
Column Header 2
Detail 2
Column Footer 2
Try to use Table elements in your report. You can use there the same dataset too.