Jasper Report Freeze header of Excel report - jasper-reports

I am using Jasper IReport designer version 3.7.6 . Is there any way to freeze the first two rows of the excel report that is generated? Below is a part of the column header. Row 1 is the PDD , Row 2 is Reparto. I want them freezed during scroll.
<columnHeader>
<band height="24">
<staticText>
<reportElement x="0" y="0" width="50" height="12">
<property name="net.sf.jasperreports.export.xls.freeze.row.edge" value="Bottom"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font size="7" isBold="true"/>
</textElement>
<text><![CDATA[ Pdd]]></text>
</staticText>
<staticText>
<reportElement x="0" y="12" width="50" height="12"/>
<textElement verticalAlignment="Middle">
<font size="7" isBold="true"/>
</textElement>
<text><![CDATA[ Reparto]]></text>
</staticText>
</band>
</columnHeader>
From the documentation : https://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.export.xls.freeze.column
I tried to use:
net.sf.jasperreports.export.xls.freeze.row
net.sf.jasperreports.export.xls.freeze.row.edge
without success. I am guessing it's because I am using an older version of Jasper Ireport. Is there any alternative to achieve my goal without updating the version of the app. Updating the version is not an option.
Thank you

Changing the export type from xlsx to xls managed to solve the issue.

Related

How to combine two textFields into one box in RTF generated by Jasper reports?

I use Jasper Reports to generate RTF file.
In RTF each textField is represented as separate box:
I tried to use one frame for textFields:
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="220" y="45" width="406" height="75"/>
<textField>
<reportElement positionType="Float" x="0" y="0" width="406" height="60"/>
<textElement>
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression><![CDATA["Address:"]]></textFieldExpression>
</textField>
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement x="0" y="57" width="200" height="15" key="textWithStyle" style="LinkField"/>
<textElement>
<font fontName="Arial" size="8" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA["here"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["http:adress"]]></hyperlinkReferenceExpression>
</textField>
</frame>
But textFields also in the different boxes.
Is it possible to combine several textFields into one box like the following?
I know that I can add each text to one textField, but sometimes I need two separate textFields that I can manage inside one box.

jasper excel report export green mark coming

I am using jasper stuido 6 to generated excel report.
After generating report I am getting green mark on cell wherever is number is coming as shown below image
same green mark is not coming from text value only.
I tried to set the below jasper property
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
and used below code
<jr:column width="50" uuid="d3d82c7c-1121-474f-b0f3-00e80cda4489">
<jr:detailCell height="20">
<textField>
<reportElement style="WhiteBackColor" x="0" y="0" width="50" height="20" uuid="1b71e76d-8111-43ee-9cfb-9070ffcf1f6d">
<printWhenExpression><![CDATA[$F{zeitQuartal}.matches("-?\\d+(\\.\\d+)?")]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="Calibri" size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[Double.parseDouble($F{zeitQuartal})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
Then green mark disapper from the generated excel report
but if any text like come in between number that is disappearing

The report with several columns: How to reprint group headers in each column?

I'm creating a report with 2 columns per page with JasperReports 4.7.1.
When the records belonging to a group span across multiple columns, I want to print the header not only at the beginning of the group but also at the start of each column.
Using Reprint Header (isReprintHeaderOnEachPage property) in group properties, header can be printed at the start of each page. But I still couldn't find a way to do the same at the start of a new column.
How can I achieve this?
Screenshot of the current report page...
What I want to achieve (note the headers in the 2nd column)...
I had a similar issue to yours and I managed to solve it by adding a ColumnHeader band and only displaying it for the 2nd column of my 2-column report.
It is important to have isReprintHeaderOnEachPage set to true and the height of the groupHeader and columnHeader to be the same for my solution to work.
Here is the relevant code (of course you replace "telephoneNumber" with your appropriate group expression:
<group name="telephoneNumberGroup" isStartNewPage="true" isReprintHeaderOnEachPage="true">
<groupExpression><![CDATA[$F{telephoneNumber}]]></groupExpression>
<groupHeader>
<band height="17">
<textField>
<reportElement positionType="Float" x="5" y="0" width="170" height="15" uuid="5e8b892b-f907-4907-9c6d-4419e57325e5"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{telephoneNumber}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<columnHeader>
<band height="17">
<printWhenExpression><![CDATA[$V{COLUMN_NUMBER} == 2]]></printWhenExpression>
<textField>
<reportElement positionType="Float" x="5" y="0" width="170" height="15" uuid="5e8b892b-f907-4907-9c6d-4419e57325e5"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{telephoneNumber}]]></textFieldExpression>
</textField>
</band>
</columnHeader>

How to display page x of y in my jasper report

I am generating the reports using jasperreport-4.5.0.It is generating the report properly.But if i have huge data in my database then the report vl display in different pages.So my requirement is if my report has 12 pages then i want to display page 1 of 12,page 2 of 12,page 3 of 12....like this in my page header band.How can i do this can any one give an idea regarding this.
You can use the evaluationTime="Report" attribute to achieve this.
Consider the following example, we first print "PAGE" then we print the page number using the default evalutaionTime attribute. This will print the current page number, then we print OF and finally the page number with evaluation time set to "report" which will print the total number of pages.
<band height="20">
<elementGroup>
<textField>
<reportElement positionType="FixRelativeToBottom" x="709" y="0" width="53" height="20"/>
<textElement verticalAlignment="Top">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA["PAGE"]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" x="762" y="0" width="23" height="20"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" x="785" y="0" width="29" height="20"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA["OF"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement positionType="FixRelativeToBottom" x="814" y="0" width="26" height="20"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</elementGroup>
</band>

Printing serial number in jasper report detail

I have created a jasper report. In that report in detail areaI have "serialNumber" column. That column wants to be auto incrementive and stats with "1". I am using hibernate for query.
Sample code is :
<detail>
<band height="17" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="12" y="0" width="27" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[serialNumber]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="51" y="0" width="37" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{date}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="138" y="0" width="75" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{time}]]>
</textFieldExpression>
</textField>
</band>
</detail>
Can anyone help to print serial number in jasper report.
Using variable we can achieve that.
Sample code :
<variable name="seraialNumber" class="java.lang.Integer" resetType="None"
calculation="Count"/>
Depends on the requirement we have to change expression
You have to bind the column to a bean which returns incrementing numbers.
You Can use alternate solution for this problem that build in Variable $V{REPORT_COUNT}.
This variable will return the row count in Integer format.
Sample Expression :
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>.
<variable name="serial number" class="java.lang.Integer" resetType="Column" calculation="Count">
<variableExpression><![CDATA[0]]></variableExpression>
</variable>
I will show an image for better understanding