I am using Spring and iReport to generate jasper reports in excel format. All is working fine but I am having a single issue that the background colour of my reports in iReport is grey, but I am getting purplish hue in my generated Excel file.
I am setting Create Custom Palette to true, still it is not having any effect.
My Jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Charges Applicable" pageWidth="792" pageHeight="612" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty" >
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<subDataset name="Table Dataset 1" >
<parameter name="ContractId" class="java.lang.String"/>
<parameter name="VersionNo" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT S.TERM_COMMENTS FROM FCM_TX_TERMINATION_CHARGE_T S
WHERE S.CONTRACT_ID=$P{ContractId} AND S.VERSION_NO=$P{VersionNo}]]>
</queryString>
<field name="TERM_COMMENTS" class="java.lang.String"/>
</subDataset>
<parameter name="ContractId" class="java.lang.String"/>
<parameter name="VersionNo" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT F.OFFSET_ABLE_AGAINST_SLA_FLAG SLA_PENALTY_APPLICABLE
FROM FCM_TX_BASIC_CONTRACT_DTLS_T F
WHERE F.CONTRACT_ID=$P{ContractId} AND F.VERSION_NO=$P{VersionNo}]]>
</queryString>
<field name="SLA_PENALTY_APPLICABLE" class="java.lang.String"/>
<summary>
<band height="120" splitType="Stretch">
<crosstab>
<reportElement x="0" y="0" width="352" height="30" />
<rowGroup name="SLA_PENALTY_APPLICABLE" width="200">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{SLA_PENALTY_APPLICABLE}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<textField>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="200" height="30" backcolor="#C9D9E7" />
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Is SLA Penalty Applicable"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="SLA_PENALTY_APPLICABLE1" height="0">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{SLA_PENALTY_APPLICABLE}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<textField>
<reportElement x="0" y="0" width="0" height="0" />
<textFieldExpression><![CDATA[$V{SLA_PENALTY_APPLICABLE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="SLA_PENALTY_APPLICABLEMeasure" class="java.lang.String">
<measureExpression><![CDATA[$F{SLA_PENALTY_APPLICABLE}]]></measureExpression>
</measure>
<crosstabCell width="100" height="30">
<cellContents>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="30" />
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression><![CDATA[( $V{SLA_PENALTY_APPLICABLEMeasure}=="Y" ? "YES" : "NO" )]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="SLA_PENALTY_APPLICABLE">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<textField>
<reportElement x="0" y="0" width="50" height="25" />
<textFieldExpression><![CDATA[$V{SLA_PENALTY_APPLICABLEMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="SLA_PENALTY_APPLICABLE1">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<textField>
<reportElement x="0" y="0" width="50" height="25" />
<textFieldExpression><![CDATA[$V{SLA_PENALTY_APPLICABLEMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="SLA_PENALTY_APPLICABLE" columnTotalGroup="SLA_PENALTY_APPLICABLE1">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<textField>
<reportElement x="0" y="0" width="50" height="25" />
<textFieldExpression><![CDATA[$V{SLA_PENALTY_APPLICABLEMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
<componentElement>
<reportElement key="table" positionType="Float" x="0" y="60" width="180" height="60"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Table Dataset 1" >
<datasetParameter name="ContractId">
<datasetParameterExpression><![CDATA[$P{ContractId}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="VersionNo">
<datasetParameterExpression><![CDATA[$P{VersionNo}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="180" >
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="0" width="180" height="30" backcolor="#C9D9E7" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="true"/>
</textElement>
<text><![CDATA[Comments]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="180" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{TERM_COMMENTS}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
<staticText>
<reportElement mode="Opaque" x="0" y="40" width="180" height="20" backcolor="#C9D9E7"/>
<textElement>
<font fontName="Arial" isBold="true"/>
</textElement>
<text><![CDATA[Temination charges for convenience]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Set the property net.sf.jasperreports.export.xls.white.page.background to true in the report jrxml.
i.e.
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false" />
The cause of strange behaviour of drawing color text
The JRXlsExporter has some limitations of using colours.
The snippet from source code of net.sf.jasperreports.engine.export.JRXlsExporter (I took source code of JR 6.3.0 version in this sample)
public void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException {
JRStyledText styledText = getStyledText(textElement);
if (styledText == null) {
return;
}
short forecolor = getWorkbookColor(textElement.getForecolor()).getIndex();
TextAlignHolder textAlignHolder = getTextAlignHolder(textElement);
short horizontalAlignment = getHorizontalAlignment(textAlignHolder);
short verticalAlignment = getVerticalAlignment(textAlignHolder);
short rotation = getRotation(textAlignHolder);
short mode = backgroundMode;
short backcolor = whiteIndex;
if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null) {
mode = HSSFCellStyle.SOLID_FOREGROUND;
backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
}
The cause of using "wrong" colour is at getWorkbookColor(Color) method from the same class:
protected HSSFColor getWorkbookColor(Color awtColor) {
byte red = (byte)awtColor.getRed();
byte green = (byte)awtColor.getGreen();
byte blue = (byte)awtColor.getBlue();
HSSFColor color = null;
if (getCurrentConfiguration().isCreateCustomPalette()) {
try {
color = palette.findColor(red,green, blue) != null
? palette.findColor(red,green, blue)
: palette.addColor(red,green, blue);
} catch(Exception e) {
if(customColorIndex < MAX_COLOR_INDEX) {
palette.setColorAtIndex(customColorIndex, red, green, blue);
color = palette.getColor(customColorIndex++);
} else {
color = palette.findSimilarColor(red, green, blue);
}
}
}
return color == null ? getNearestColor(awtColor) : color;
}
The color is defined with help of getNearestColor(Color) method:
protected HSSFColor getNearestColor(Color awtColor) {
HSSFColor color = hssfColorsCache.get(awtColor);
if (color == null) {
int minDiff = Integer.MAX_VALUE;
for (Map.Entry<HSSFColor, short[]> hssfColorEntry : hssfColorsRgbs.entrySet()) {
HSSFColor crtColor = hssfColorEntry.getKey();
short[] rgb = hssfColorEntry.getValue();
int diff = Math.abs(rgb[0] - awtColor.getRed()) + Math.abs(rgb[1] - awtColor.getGreen()) + Math.abs(rgb[2] - awtColor.getBlue());
if (diff < minDiff) {
minDiff = diff;
color = crtColor;
}
}
hssfColorsCache.put(awtColor, color);
}
return color;
}
If color (backcolor) of element is not present at supported colours list at org.apache.poi.hssf.util.HSSFColor class of Apache POI library the "nearest" color will be used.
For grey color (for example, #F2F2F2) the nearest color can be white. In this case JRXlsExporter will draw text with white backcolor ignoring original backcolor of textField element.
The JRXlsxExporter does not have this problem.
How to solve problem?
As we can see the getWorkbookColor method has this check:
if (getCurrentConfiguration().isCreateCustomPalette()) {
What if we can turn on custom pallette? Yes, this will solve our problem - in this case the original color will be applied.
We can enable custom pallete with help of net.sf.jasperreports.export.xls.create.custom.palette property or with help of Java API. The SimpleXlsExporterConfiguration.setCreateCustomPalette(Boolean) method will do the same stuff as net.sf.jasperreports.export.xls.create.custom.palette property.
Working example
I took colors of standard palette in Excel from HSSFColor class and prepared jrxml demonstrated which colors are supported by JRXlsExporter out of box.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="All supported colours by JRXlsExporter" pageWidth="960" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="960" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" >
<property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<title>
<band height="210">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="10" width="960" height="25" forecolor="#000000" backcolor="#F2F2F2" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[All supported colours by JRXlsExporter]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="50" width="160" height="20" forecolor="#FFFFFF" backcolor="#000000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[BLACK]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="70" width="160" height="20" forecolor="#FFFFFF" backcolor="#993300" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[BROWN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="90" width="160" height="20" forecolor="#FFFFFF" backcolor="#333300" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[OLIVE_GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="110" width="160" height="20" forecolor="#FFFFFF" backcolor="#003300" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DARK_GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="130" width="160" height="20" forecolor="#FFFFFF" backcolor="#003366" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DARK_TEAL]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="150" width="160" height="20" forecolor="#FFFFFF" backcolor="#000080" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DARK_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="170" width="160" height="20" forecolor="#FFFFFF" backcolor="#333399" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[INDIGO]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="190" width="160" height="20" forecolor="#FFFFFF" backcolor="#333333" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GREY_80_PERCENT]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="50" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF6600" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ORANGE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="70" width="160" height="20" forecolor="#FFFFFF" backcolor="#808000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DARK_YELLOW]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="90" width="160" height="20" forecolor="#FFFFFF" backcolor="#008000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="110" width="160" height="20" forecolor="#FFFFFF" backcolor="#008080" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[TEAL]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="130" width="160" height="20" forecolor="#FFFFFF" backcolor="#0000FF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="150" width="160" height="20" forecolor="#FFFFFF" backcolor="#666699" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[BLUE_GREY]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="170" width="160" height="20" forecolor="#FFFFFF" backcolor="#808080" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GREY_50_PERCENT]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="190" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF0000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[RED]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="50" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF9900" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_ORANGE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="70" width="160" height="20" forecolor="#FFFFFF" backcolor="#99CC00" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIME]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="90" width="160" height="20" forecolor="#FFFFFF" backcolor="#339966" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[SEA_GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="110" width="160" height="20" forecolor="#FFFFFF" backcolor="#33CCCC" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[AQUA]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="130" width="160" height="20" forecolor="#FFFFFF" backcolor="#3366FF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="150" width="160" height="20" forecolor="#FFFFFF" backcolor="#800080" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[VIOLET]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="170" width="160" height="20" forecolor="#FFFFFF" backcolor="#969696" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GREY_40_PERCENT]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="190" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF00FF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PINK]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="50" width="160" height="20" forecolor="#FFFFFF" backcolor="#FFCC00" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GOLD]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="70" width="160" height="20" forecolor="#000000" backcolor="#FFFF00" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[YELLOW]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="90" width="160" height="20" forecolor="#000000" backcolor="#00FF00" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[BRIGHT_GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="110" width="160" height="20" forecolor="#000000" backcolor="#00FFFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[TURQUOISE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="130" width="160" height="20" forecolor="#FFFFFF" backcolor="#800000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DARK_RED]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="150" width="160" height="20" forecolor="#FFFFFF" backcolor="#00CCFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[SKY_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="170" width="160" height="20" forecolor="#FFFFFF" backcolor="#993366" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PLUM]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="480" y="190" width="160" height="20" forecolor="#FFFFFF" backcolor="#C0C0C0" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[GREY_25_PERCENT]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="50" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF99CC" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ROSE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="70" width="160" height="20" forecolor="#000000" backcolor="#FFFF99" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_YELLOW]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="90" width="160" height="20" forecolor="#000000" backcolor="#CCFFCC" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_GREEN]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="110" width="160" height="20" forecolor="#000000" backcolor="#CCFFFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_TURQUOISE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="130" width="160" height="20" forecolor="#000000" backcolor="#99CCFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PALE_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="150" width="160" height="20" forecolor="#FFFFFF" backcolor="#CC99FF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LAVENDER]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="170" width="160" height="20" forecolor="#000000" backcolor="#FFFFFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[WHITE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="640" y="190" width="160" height="20" forecolor="#FFFFFF" backcolor="#9999FF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[CORNFLOWER_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="50" width="160" height="20" forecolor="#000000" backcolor="#FFFFCC" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LEMON_CHIFFON]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="70" width="160" height="20" forecolor="#FFFFFF" backcolor="#7F0000" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[MAROON]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="90" width="160" height="20" forecolor="#FFFFFF" backcolor="#660066" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ORCHID]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="110" width="160" height="20" forecolor="#FFFFFF" backcolor="#FF8080" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[CORAL]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="130" width="160" height="20" forecolor="#FFFFFF" backcolor="#0066CC" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ROYAL_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="150" width="160" height="20" forecolor="#000000" backcolor="#CCCCFF" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[LIGHT_CORNFLOWER_BLUE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="800" y="170" width="160" height="20" forecolor="#000000" backcolor="#FFCC99" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[TAN]]></text>
</staticText>
</band>
</title>
</jasperReport>
At JSS (Jaspersoft Studio) the output result looks like this:
Without applying <property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/> the generated xls file will be like this:
The textField with "All supported colours by JRXlsExporter" text has backcolor="#F2F2F2" attribute (this is grey color), but the text was generated without backcolor (color is white).
With custom pallete the generated result is:
As we can see applying custom palette has solved problem of JRXlsExporter.
If you have a parent report and a child report and you have set only in child, it will not work. Set the property in both parent and child report.
Related
im trying to use subreports in jaspersoft studio but in the preview the subreport area is always empty, i tried a lot of things but no one is a solution, what am I doing wrong ?
here is my code
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4eb55d03-56c6-4337-9b1b-e2f10a2d06d4">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter"/>
<style name="Style1" forecolor="#C2C2C2"/>
<parameter name="REPORT_ID" class="java.lang.Integer">
<defaultValueExpression><![CDATA[0]]></defaultValueExpression>
</parameter>
<parameter name="CREATED_AT" class="java.sql.Date"/>
<parameter name="AVERAGE_SELL_VALUE" class="java.lang.String"/>
<parameter name="MIN_SELL_VALUE" class="java.lang.String"/>
<parameter name="MAX_SELL_VALUE" class="java.lang.String"/>
<parameter name="AVERAGE_RETAKE_VALUE" class="java.lang.String"/>
<parameter name="MIN_RETAKE_VALUE" class="java.lang.String"/>
<parameter name="MAX_RETAKE_VALUE" class="java.lang.String"/>
<parameter name="BRAND" class="java.lang.String"/>
<parameter name="MODEL" class="java.lang.String"/>
<parameter name="YEAR" class="java.lang.String"/>
<parameter name="VERSION" class="java.lang.String"/>
<parameter name="KM" class="java.lang.String"/>
<parameter name="CYLINDER_CAPACITY" class="java.lang.String"/>
<parameter name="FUEL_TYPE" class="java.lang.String"/>
<parameter name="TRANSMISION" class="java.lang.String"/>
<parameter name="TRACTION" class="java.lang.String"/>
<parameter name="COLOR" class="java.lang.String"/>
<parameter name="PRICE_ADJUST" class="java.lang.String"/>
<parameter name="KM_ADJUST" class="java.lang.String"/>
<parameter name="AVERAGE_VALUE" class="java.lang.String"/>
<queryString language="JSON">
<![CDATA[report_url]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="73" splitType="Stretch">
<textField>
<reportElement x="475" y="5" width="135" height="30" forecolor="#888888" uuid="e2639b23-eddb-4d9a-a25e-f0f153aa991b"/>
<textFieldExpression><![CDATA[$P{REPORT_ID}]]></textFieldExpression>
</textField>
<image>
<reportElement x="5" y="5" width="110" height="40" uuid="e2cc72cc-5ada-47c0-a442-74b0bdc14af6"/>
<imageExpression><![CDATA["/home/jaimo/Descargas/Group 1.svg"]]></imageExpression>
</image>
<line>
<reportElement x="125" y="23" width="1" height="15" forecolor="#888888" uuid="0bfa9970-6235-4cad-b1e3-16ca2899131c">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<textField>
<reportElement x="475" y="20" width="101" height="30" forecolor="#888888" uuid="45a9e1de-56fa-49eb-95e2-85c2c1c06dc1">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement>
<font size="11"/>
</textElement>
<textFieldExpression><![CDATA[$P{CREATED_AT}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="135" y="15" width="178" height="30" forecolor="#888888" uuid="9ce24531-f175-4d0d-9759-e9535850818d"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<text><![CDATA[Informe de tasación]]></text>
</staticText>
<staticText>
<reportElement x="316" y="5" width="141" height="30" forecolor="#14344A" uuid="a6e2f389-858b-448a-844f-ed88681760fe"/>
<textElement textAlignment="Right">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Id Informe:]]></text>
</staticText>
<staticText>
<reportElement x="315" y="20" width="141" height="30" forecolor="#14344A" uuid="a62ca2cd-33e9-47d2-885f-b9fede598ff4">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement textAlignment="Right">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[fecha de emisión:]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="580">
<rectangle radius="10">
<reportElement x="5" y="55" width="260" height="340" forecolor="#5F6C75" uuid="a58c5d5c-b271-47e4-aa61-8c08a244322b"/>
</rectangle>
<rectangle radius="10">
<reportElement x="286" y="55" width="272" height="160" uuid="170a4d89-8ed9-491f-b862-1b9c708e651f"/>
</rectangle>
<rectangle radius="10">
<reportElement x="286" y="235" width="272" height="160" uuid="d1b5568e-f4be-4cfa-a8cc-6d761b69cbaf"/>
</rectangle>
<textField>
<reportElement x="308" y="125" width="149" height="40" forecolor="#373737" uuid="90c5e1eb-1aa2-49bd-a8f7-574d7a11d694"/>
<textElement verticalAlignment="Middle">
<font size="24" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["$" +$P{AVERAGE_SELL_VALUE}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="308" y="165" width="219" height="30" forecolor="#5F6C75" uuid="d9a02936-a161-4e50-81dd-bf1e84db717a">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA["Rango: $" + $P{MIN_SELL_VALUE} + " / $" + $P{MAX_SELL_VALUE}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="25" y="65" width="100" height="30" forecolor="#373737" uuid="45ac0bb9-dfa0-43d0-a28f-0f08225492f6"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Marca:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="95" width="100" height="30" forecolor="#373737" uuid="0f81a7ce-35c7-4cf5-b46f-ce01e2e61cc7"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Modelo:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="125" width="100" height="30" forecolor="#373737" uuid="a84b857a-04af-492a-9140-7f734b4b341b"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Año:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="155" width="100" height="30" forecolor="#373737" uuid="1498a093-14cc-4dfd-9590-d805b492ed95"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Versión:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="185" width="100" height="30" forecolor="#373737" uuid="96a49dab-037c-44bf-8447-e1789ecc4c0a"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[KM:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="215" width="100" height="30" forecolor="#373737" uuid="0e5d5220-2bcc-4c6a-9ab2-35e1b0599a2b"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Cilindrada:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="245" width="100" height="30" forecolor="#373737" uuid="33ac256b-af52-4f8b-ad65-10db6f634839"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Combustible:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="275" width="100" height="30" forecolor="#373737" uuid="a2ce1334-6202-4377-89dd-b1e0baae6260"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Transmisión:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="305" width="100" height="30" forecolor="#373737" uuid="b696d922-ba43-4567-869c-de9cb3c6c9a4"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Tracción:]]></text>
</staticText>
<staticText>
<reportElement x="24" y="335" width="100" height="30" forecolor="#373737" uuid="a49c4cce-9f76-4360-ac4b-dcab33467bca"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Color:]]></text>
</staticText>
<textField>
<reportElement x="124" y="66" width="130" height="30" forecolor="#5F6C75" uuid="eb22f28d-68cc-47ce-a208-8bcae9792fa9"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{BRAND}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="95" width="130" height="30" forecolor="#5F6C75" uuid="b4480708-0492-49ee-8ff3-d5789b5dbaa8"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{MODEL}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="125" width="130" height="30" forecolor="#5F6C75" uuid="cf88497c-1d1a-4ea2-8bdd-e6e2209c60b9"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{YEAR}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="155" width="130" height="30" forecolor="#5F6C75" uuid="1a88da33-0b39-40de-a348-ca95b83a56c3"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{VERSION}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="185" width="130" height="30" forecolor="#5F6C75" uuid="688eace4-c2fe-4259-88a9-7d7e1af8d04c"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{KM} + "(*)"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="125" y="215" width="129" height="30" forecolor="#5F6C75" uuid="7249875a-c675-4d38-b4aa-c20fd1d5eaaa"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{CYLINDER_CAPACITY}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="245" width="130" height="30" forecolor="#5F6C75" uuid="33531f34-34c8-4f2b-92f3-f5ba68111cae"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{FUEL_TYPE}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="275" width="130" height="30" forecolor="#5F6C75" uuid="36733743-1493-4817-bccc-89354c405821"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{TRANSMISION}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="305" width="130" height="30" forecolor="#5F6C75" uuid="d484ecbc-e947-44e6-9a51-55f985f6663c"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{TRACTION}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="124" y="335" width="130" height="30" forecolor="#5F6C75" uuid="80aa9276-a814-484a-8604-dc0a6057aab8"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{COLOR}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="25" y="360" width="230" height="30" forecolor="#5F6C75" uuid="3e0ddb85-12f4-4398-b318-eb6aedf1cc7f">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<text><![CDATA[(*) Promedio de km según antigüedad del vehiculo]]></text>
</staticText>
<staticText>
<reportElement x="305" y="245" width="240" height="20" forecolor="#14344A" uuid="fbddbb33-251d-4cbb-94c3-e324504b44a5"/>
<textElement verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Valor en recepción en parte de pago]]></text>
</staticText>
<staticText>
<reportElement x="305" y="265" width="240" height="40" forecolor="#888888" uuid="775a79e7-7d53-44d4-a885-d66f25181fa0"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Precio promedio, máximo y mínimo al entregar el vehículo como parte de pago de otro vehículo.]]></text>
</staticText>
<staticText>
<reportElement x="308" y="65" width="237" height="30" forecolor="#14344A" uuid="efdf8857-7032-482d-8c46-bd2768ae1120"/>
<textElement verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Valor estimado de venta]]></text>
</staticText>
<textField>
<reportElement x="305" y="305" width="222" height="40" forecolor="#373737" uuid="da02e43b-7bea-42ca-9885-739414847863"/>
<textElement verticalAlignment="Middle">
<font size="24" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["$" +$P{AVERAGE_RETAKE_VALUE}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="305" y="345" width="219" height="30" forecolor="#5F6C75" uuid="07c566a7-bd8c-46d2-b1b8-6ad1839ddfa7">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA["Rango: $" + $P{MIN_RETAKE_VALUE} + " / $" + $P{MAX_RETAKE_VALUE}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="306" y="85" width="240" height="40" forecolor="#888888" uuid="4b05c58f-9941-4649-9b0d-98facaae4260"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text><![CDATA[Precio promedio, máximo y mínimo de venta del vehículo.]]></text>
</staticText>
<image>
<reportElement x="15" y="10" width="30" height="30" uuid="f82c5f90-dada-4f88-a2c2-849bbc925556"/>
<imageExpression><![CDATA["/home/jaimo/Descargas/jasper_icons/single_car_icon.svg"]]></imageExpression>
</image>
<staticText>
<reportElement x="56" y="5" width="199" height="40" forecolor="#14344A" uuid="87f30195-0739-4c08-a782-6cf92a464de7"/>
<textElement verticalAlignment="Middle">
<font size="18"/>
</textElement>
<text><![CDATA[Datos del vehículo]]></text>
</staticText>
<subreport>
<reportElement x="0" y="430" width="558" height="120" uuid="7b860fe8-8737-46c2-8fc5-9747720f3abd"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
</subreport>
</band>
</columnHeader>
<pageFooter>
<band height="121" splitType="Stretch">
<image>
<reportElement x="-20" y="0" width="450" height="121" uuid="618a75d4-e981-47c5-b316-266e3b91666c"/>
<imageExpression><![CDATA["/home/jaimo/Descargas/miscelaneas.svg"]]></imageExpression>
</image>
<textField>
<reportElement x="470" y="45" width="100" height="30" uuid="b9eeb12e-542b-4da0-a6ce-64e071382a81"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
and here is subreport expression
<subreport>
<reportElement x="0" y="430" width="558" height="120" uuid="7b860fe8-8737-46c2-8fc5-9747720f3abd"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
</subreport>
I am using japer 3.7.6 in my project.Jasper works good locally in my computer.When the same project is hosted in linux server there appears this issue.For some reports jasper is working but in some reports it shows following error :
In Firefox :
In Chrome:
My jasper report code is like this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="shareDividentReport_np" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.report.description" value=""/>
<property name="ireport.zoom" value="1.652892561983471"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="address" class="java.lang.String"/>
<parameter name="institutionName" class="java.lang.String"/>
<parameter name="scheme" class="java.lang.String"/>
<parameter name="trxnDate" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="custName" class="java.lang.String">
<fieldDescription><![CDATA[custName]]></fieldDescription>
</field>
<field name="sNo" class="java.lang.Integer"/>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
<field name="accNo" class="java.lang.String"/>
<field name="amount" class="java.math.BigDecimal"/>
<field name="remarks" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="61" splitType="Stretch">
<textField>
<reportElement x="337" y="19" width="215" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="305" y="-1" width="247" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{institutionName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="3" y="2" width="142" height="22"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" isBold="true"/>
</textElement>
<text><![CDATA[Fund Distribution Report]]></text>
</staticText>
<staticText>
<reportElement x="400" y="41" width="81" height="14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="true"/>
</textElement>
<text><![CDATA[Transaction Date :]]></text>
</staticText>
<staticText>
<reportElement x="3" y="41" width="73" height="14"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="true"/>
</textElement>
<text><![CDATA[Scheme Name :]]></text>
</staticText>
<textField>
<reportElement x="77" y="41" width="124" height="14"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{scheme}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="481" y="41" width="70" height="14"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{trxnDate}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="17" splitType="Stretch">
<staticText>
<reportElement x="3" y="1" width="22" height="14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[#]]></text>
</staticText>
<line>
<reportElement x="1" y="0" width="554" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="0" y="0" width="1" height="16"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="1" y="16" width="554" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="25" y="0" width="1" height="16"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="131" y="1" width="1" height="16"/>
</line>
<staticText>
<reportElement x="28" y="1" width="106" height="14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[Name]]></text>
</staticText>
<line>
<reportElement x="201" y="1" width="1" height="16"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<staticText>
<reportElement x="204" y="1" width="58" height="14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[Acc No]]></text>
</staticText>
<line>
<reportElement x="261" y="1" width="1" height="16"/>
</line>
<line>
<reportElement x="368" y="1" width="1" height="16"/>
</line>
<line>
<reportElement x="554" y="1" width="1" height="16"/>
</line>
<staticText>
<reportElement x="134" y="1" width="68" height="14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[Address]]></text>
</staticText>
<staticText>
<reportElement x="262" y="0" width="107" height="17">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="1e3ff973-33f4-46e2-8c61-70a570ebcd40"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[Amount]]></text>
</staticText>
<staticText>
<reportElement x="370" y="0" width="184" height="17">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="5f9168c6-3ec7-40d1-92ec-fd6608f42808"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[Remarks]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="17" splitType="Stretch">
<line>
<reportElement x="0" y="-1" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" x="25" y="0" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="131" y="-1" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="201" y="0" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="261" y="0" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="368" y="0" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="554" y="-1" width="1" height="16" isPrintWhenDetailOverflows="true"/>
</line>
<line>
<reportElement x="0" y="15" width="554" height="1"/>
</line>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="30" y="-1" width="100" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="737f7de1-b4b4-49bd-8d44-4fa181039ac1"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{custName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="-1" width="25" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d6382c06-3ada-460a-9cd4-eb3c7a6404b9"/>
<printWhenExpression><![CDATA[$F{sNo}>0]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{sNo}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="135" y="-1" width="66" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="18069ac2-9301-4317-b20a-447a97937054"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="202" y="-1" width="56" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fb1cc6a9-727b-4827-847a-48952b87e8ba"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{accNo}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="262" y="-1" width="101" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="8a107053-079b-4a12-83ed-5ec9e16a7613"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{amount}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="373" y="-1" width="181" height="16">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="421fa618-29d6-4861-b625-ffa1e0b8d73a"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{remarks}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Similarly code to print is like this:
JasperPrint jasperPrint;
try {
jasperPrint = JasperFillManager.fillReport(reportPath, params,
new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource(lstFundDistReport));
HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance()
.getExternalContext().getResponse();
httpServletResponse.addHeader("Content-disposition", "inline; filename=FundDistReport.pdf");
ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream);
FacesContext.getCurrentInstance().responseComplete();
servletOutputStream.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I have used same code to print different reports in my application.I repeat in local computer every reports are working fine.But same application hosted in Linux server gives such unusual error. Some reports are exported to pdf but majorly this issue appears for others reports.
Here are some screen shots to demonstrate the problem:
First, here is the design with no list element:
And here is the result of that report (note that there are two pages):
Now if I add the list element, here is the design:
Here is the jrxml for the summary band:
<summary>
<band height="554">
<printWhenExpression><![CDATA[!$F{drawingRevision}.getPartsList().isEmpty() || !$F{drawingRevision}.getProcesses().isEmpty() || !$F{drawingRevision}.getParameters().isEmpty()]]></printWhenExpression>
<staticText>
<reportElement positionType="Float" x="80" y="30" width="100" height="20" uuid="3210d220-35e0-4984-a00d-be4ad58feca4"/>
<text><![CDATA[Static Text]]></text>
</staticText>
<rectangle radius="5">
<reportElement x="0" y="0" width="284" height="16" backcolor="#E1E3FC" uuid="88870baf-afe8-4c0a-9b5f-fe88eb0f4dd3"/>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="5" y="0" width="113" height="16" uuid="9231dea5-26f2-40a8-8b45-2ce560e0f2ba"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[Design Parameters]]></text>
</staticText>
<componentElement>
<reportElement x="0" y="16" width="284" height="13" uuid="12a8a577-6c77-4849-84c6-362544413192">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="Parameters"/>
</reportElement>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="DrawingRevisionParameters" uuid="5ff517f3-e25b-4ed5-8589-33076f52c2c2">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{drawingRevision}.getParameters())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="13" width="284">
<textField pattern="#,##0.####">
<reportElement x="0" y="0" width="50" height="12" uuid="9239498a-9b30-495f-a571-b505fceba75a"/>
<textElement textAlignment="Right">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getParameterValue()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="54" y="0" width="72" height="12" uuid="f2c8d327-e8b4-4f5b-af0c-dad19c0fc4bb"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getParameterUnit().getUnitAbbr()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="132" y="0" width="150" height="12" uuid="0e48fb28-af4b-4fac-8069-63bc1f880d80"/>
<textElement markup="rtf">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getSpecification().getSpecificationName()]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</summary>
And finally here is the result of that report.
Note that the floating "Static Text" label moved down appropriately, but not nearly enough to add an extra page to the report. However, you'll see that there are now 3 pages to the report anyway.
The only thing that changed was adding the list element. How can I make it so that it doesn't add the extra page? Or what am I not understanding with regard to lists? I could probably also pass the data into a sub-report so that the data is presented in the detail band of the sub-report, but I would much prefer to use a list if I could, since it seems much simpler to me. I am using version 6.6.0. Thanks!
Here is the full jrxml as requested (uuids removed to save on characters):
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Drawing" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" whenResourceMissingType="Error">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<subDataset name="DrawingRevisionNotes">
<queryString>
<![CDATA[]]>
</queryString>
<field name="orderNum" class="java.lang.Integer">
<fieldDescription><![CDATA[orderNum]]></fieldDescription>
</field>
<field name="drawingNote" class="com.engineering.domain.drawings.DrawingNote">
<fieldDescription><![CDATA[drawingNote]]></fieldDescription>
</field>
</subDataset>
<subDataset name="DrawingApprovals">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="revisionID" class="java.lang.String">
<fieldDescription><![CDATA[revisionID]]></fieldDescription>
</field>
<field name="drafter" class="java.lang.String">
<fieldDescription><![CDATA[drafter]]></fieldDescription>
</field>
<field name="approver" class="java.lang.String">
<fieldDescription><![CDATA[approver]]></fieldDescription>
</field>
<field name="approvalDate" class="java.lang.String">
<fieldDescription><![CDATA[approvalDate]]></fieldDescription>
</field>
</subDataset>
<subDataset name="DrawingRevisionParameters">
<queryString>
<![CDATA[]]>
</queryString>
<field name="drawingParameterID" class="java.lang.Integer">
<fieldDescription><![CDATA[drawingParameterID]]></fieldDescription>
</field>
<field name="parameter" class="com.engineering.domain.drawings.DrawingParameter">
<fieldDescription><![CDATA[parameter]]></fieldDescription>
</field>
<field name="orderNum" class="java.lang.Integer">
<fieldDescription><![CDATA[orderNum]]></fieldDescription>
</field>
</subDataset>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["static/"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<field name="draftCount" class="java.lang.Integer">
<fieldDescription><![CDATA[draftCount]]></fieldDescription>
</field>
<field name="releaseType" class="com.engineering.domain.drawings.DrawingReleaseType">
<fieldDescription><![CDATA[releaseType]]></fieldDescription>
</field>
<field name="releaser" class="com.humanresources.domain.Employee">
<fieldDescription><![CDATA[releaser]]></fieldDescription>
</field>
<field name="releaseTimeStamp" class="java.time.LocalDateTime">
<fieldDescription><![CDATA[releaseTimeStamp]]></fieldDescription>
</field>
<field name="company" class="com.companies.domain.Company">
<fieldDescription><![CDATA[company]]></fieldDescription>
</field>
<field name="unitSystem" class="com.utilities.domain.units.UnitSystem">
<fieldDescription><![CDATA[unitSystem]]></fieldDescription>
</field>
<field name="drawingReleaseID" class="java.lang.Integer">
<fieldDescription><![CDATA[drawingReleaseID]]></fieldDescription>
</field>
<field name="fullDescription" class="java.lang.Boolean">
<fieldDescription><![CDATA[fullDescription]]></fieldDescription>
</field>
<field name="drawingRevision" class="com.engineering.domain.drawings.DrawingRevision">
<fieldDescription><![CDATA[drawingRevision]]></fieldDescription>
</field>
<background>
<band height="554" splitType="Stretch">
<rectangle radius="5">
<reportElement mode="Transparent" x="0" y="0" width="752" height="553"/>
</rectangle>
<frame>
<reportElement x="485" y="443" width="267" height="110">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<rectangle radius="5">
<reportElement mode="Transparent" x="0" y="0" width="267" height="110"/>
<graphicElement>
<pen lineWidth="1.0"/>
</graphicElement>
</rectangle>
<subreport>
<reportElement x="0" y="0" width="180" height="34"/>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR}+"HeaderSmall.jasper"]]></subreportExpression>
</subreport>
<line>
<reportElement x="0" y="35" width="180" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<staticText>
<reportElement x="39" y="36" width="21" height="7"/>
<textElement>
<font size="5"/>
</textElement>
<text><![CDATA[Title]]></text>
</staticText>
<textField>
<reportElement x="44" y="40" width="136" height="47"/>
<textElement verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{drawingRevision}.getTitle()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="39" y="90" width="21" height="7"/>
<textElement>
<font size="5"/>
</textElement>
<text><![CDATA[Drawing]]></text>
</staticText>
<textField>
<reportElement x="44" y="94" width="136" height="16"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[String.format("%06d",$F{drawingRevision}.getDrawing().getDrawingID())+" Rev "+$F{drawingRevision}.getRevision().getRevisionID()]]></textFieldExpression>
</textField>
<line>
<reportElement x="38" y="36" width="1" height="74"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="180" y="0" width="1" height="110"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement x="39" y="89" width="141" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<frame>
<reportElement x="0" y="36" width="37" height="74"/>
<staticText>
<reportElement x="2" y="2" width="33" height="7"/>
<textElement textAlignment="Center">
<font size="5" isItalic="true" isUnderline="true"/>
</textElement>
<text><![CDATA[Tolerances]]></text>
</staticText>
<textField>
<reportElement x="2" y="9" width="33" height="20"/>
<textElement textAlignment="Center">
<font size="5" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{unitSystem}.getUnitTolerance().getUnit().getUnitNamePlural()+"\nUnless\nNoted"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="2" y="29" width="33" height="33"/>
<textElement textAlignment="Center">
<font size="5" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[($F{unitSystem}.getUnitTolerance().getTolerance3Place()!=null ? "X.XXX ±"+$F{unitSystem}.getUnitTolerance().getTolerance3Place()+"\n" : "")+
($F{unitSystem}.getUnitTolerance().getTolerance2Place()!=null ? "X.XX ±"+$F{unitSystem}.getUnitTolerance().getTolerance2Place()+"\n" : "")+
($F{unitSystem}.getUnitTolerance().getTolerance1Place()!=null ? "X.X ±"+$F{unitSystem}.getUnitTolerance().getTolerance1Place()+"\n" : "")+
($F{unitSystem}.getUnitTolerance().getFractional()!=null ? "Frac. ±"+$F{unitSystem}.getUnitTolerance().getFractional()+"\n" : "")+
"Ang. ±30'"]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="180" y="0" width="87" height="109"/>
<componentElement>
<reportElement x="3" y="14" width="81" height="9">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="Approvals"/>
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()==1]]></printWhenExpression>
</reportElement>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="DrawingApprovals">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{drawingRevision}.getApprovals())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="9" width="81">
<textField>
<reportElement x="0" y="0" width="17" height="9"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{revisionID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="17" y="0" width="17" height="9"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{drafter}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="34" y="0" width="17" height="9"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{approver}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="51" y="0" width="30" height="9"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{approvalDate}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<staticText>
<reportElement x="3" y="3" width="17" height="11">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()==1]]></printWhenExpression>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[REV]]></text>
</staticText>
<staticText>
<reportElement x="20" y="3" width="17" height="11">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<text><![CDATA[BY]]></text>
</staticText>
<staticText>
<reportElement x="37" y="3" width="17" height="11">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<text><![CDATA[APV]]></text>
</staticText>
<staticText>
<reportElement x="54" y="3" width="30" height="11">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<text><![CDATA[DATE]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement x="3" y="14" width="81" height="0">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()!=1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["PRELIMINARY REVISION "+$F{drawingRevision}.getRevision().getRevisionID()]]></textFieldExpression>
</textField>
<line>
<reportElement positionType="Float" x="3" y="17" width="82" height="1">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()!=1]]></printWhenExpression>
</reportElement>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="3" y="20" width="82" height="0">
<printWhenExpression><![CDATA[$F{drawingRevision}.getRevision().getRevisionType().getRevisionTypeID()!=1]]></printWhenExpression>
</reportElement>
<textElement>
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA["REV BY APV DATE\n - "+$F{drawingRevision}.getDrafter().getInitials()]]></textFieldExpression>
</textField>
</frame>
</frame>
</band>
</background>
<detail>
<band height="554" splitType="Stretch">
<image scaleImage="RetainShape">
<reportElement x="5" y="5" width="742" height="548"/>
<imageExpression><![CDATA["\\\\SERVER\\Data\\Design Files\\Drawings\\ERP Draft Images\\"+String.format("%05d",$F{drawingRevision}.getDrawing().getDrawingID())+$F{drawingRevision}.getRevision().getRevisionID()+($F{draftCount}>1 ? "p"+$F{draftCount} : "")+".jpg"]]></imageExpression>
</image>
<componentElement>
<reportElement x="4" y="420" width="400" height="30">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="Notes"/>
</reportElement>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="DrawingRevisionNotes">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{drawingRevision}.getNotes())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="400">
<staticText>
<reportElement x="0" y="0" width="48" height="14"/>
<text><![CDATA[NOTES]]></text>
</staticText>
<textField>
<reportElement x="0" y="14" width="15" height="14"/>
<textFieldExpression><![CDATA[$F{orderNum}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="16" y="14" width="384" height="14"/>
<textFieldExpression><![CDATA[$F{drawingNote}.getNoteText()]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<frame>
<reportElement x="485" y="405" width="267" height="38">
<printWhenExpression><![CDATA[$F{drawingRevision}.getMaterial()!=null]]></printWhenExpression>
</reportElement>
<rectangle radius="5">
<reportElement x="0" y="0" width="267" height="38"/>
</rectangle>
<staticText>
<reportElement x="4" y="0" width="100" height="13"/>
<text><![CDATA[Material]]></text>
</staticText>
<line>
<reportElement x="4" y="12" width="259" height="1"/>
</line>
<staticText>
<reportElement x="138" y="0" width="61" height="13"/>
<text><![CDATA[Coating]]></text>
</staticText>
<staticText>
<reportElement x="199" y="0" width="64" height="13"/>
<text><![CDATA[Notes]]></text>
</staticText>
<textField>
<reportElement x="4" y="13" width="134" height="24"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{drawingRevision}.getMaterial().getMaterialRaw().getShortDescriptionNoCondition() + ( $F{drawingRevision}.getMaterial().getMaterialRaw().getMaterialCondition() == null || $F{drawingRevision}.getMaterial().getMaterialRaw().getMaterialCondition().getConditionDescription() == null || $F{drawingRevision}.getMaterial().getMaterialRaw().getMaterialCondition().getConditionDescription().trim() == "" ? "" : ", "+$F{drawingRevision}.getMaterial().getMaterialRaw().getMaterialCondition().getConditionDescription() )]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="138" y="13" width="61" height="24"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{drawingRevision}.getMaterial().getMaterialCoating()==null ? "" : $F{drawingRevision}.getMaterial().getMaterialCoating().getCoatingDescription()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="199" y="13" width="64" height="24"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{drawingRevision}.getMaterial().getMaterialNotes()]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<pageFooter>
<band height="12" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="418" height="12"/>
<textElement>
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{releaseTimeStamp}+" Release ID: "+$F{drawingReleaseID}+" "+$F{company}.getCompanyName()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="430" y="0" width="257" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[This proprietary drawing shall not be shared without written permission.]]></text>
</staticText>
<textField>
<reportElement x="687" y="0" width="50" height="12"/>
<textElement textAlignment="Right">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="737" y="0" width="15" height="12"/>
<textElement>
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="554">
<printWhenExpression><![CDATA[!$F{drawingRevision}.getPartsList().isEmpty() || !$F{drawingRevision}.getProcesses().isEmpty() || !$F{drawingRevision}.getParameters().isEmpty()]]></printWhenExpression>
<frame>
<reportElement x="467" y="1" width="284" height="318">
<printWhenExpression><![CDATA[!$F{drawingRevision}.getParameters().isEmpty()]]></printWhenExpression>
</reportElement>
<box>
<pen lineWidth="0.25"/>
</box>
<rectangle radius="5">
<reportElement x="0" y="0" width="284" height="16" backcolor="#E1E3FC"/>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="5" y="0" width="113" height="16"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[Design Parameters]]></text>
</staticText>
<componentElement>
<reportElement x="0" y="16" width="284" height="13">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="Parameters"/>
</reportElement>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="DrawingRevisionParameters">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{drawingRevision}.getParameters())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="13" width="284">
<textField pattern="#,##0.####">
<reportElement x="0" y="0" width="50" height="12"/>
<textElement textAlignment="Right">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getParameterValue()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="54" y="0" width="72" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getParameterUnit().getUnitAbbr()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="132" y="0" width="150" height="12"/>
<textElement markup="rtf">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{parameter}.getSpecification().getSpecificationName()]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</frame>
<staticText>
<reportElement positionType="Float" x="560" y="319" width="100" height="30"/>
<text><![CDATA[Static Text]]></text>
</staticText>
</band>
</summary>
</jasperReport>
I've encountered this before and the fixes I did was.
Check the size of the detail band and make sure that the list of values generated can all fit into the same page. Reduce the size of the detail band to see the difference.
Another is hide bands that are not in use or empty. For example try hiding the Summary band by setting it's Print When Expression to Boolean.FALSE.
You can also go to Report Properties > Check off Ignore Pagination Property
The objective of my study is to print a table that I have on SQL Server, the data connecting is done, the interface and the printing are done too.
The problem occurs when I print the PDf of the report because I want to print a number of rows per page but it only prints me one row of the table per page, so if my table has 205 rows, it prints 205 pages, haha, kinda weird.
This is my first time using JasperReports. Here is my jrxml file.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="listadoCensosDiarios" language="groovy" printOrder="Horizontal" pageWidth="2400" pageHeight="1000" orientation="Landscape" columnWidth="2360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d8233986-9ca6-4eb9-852a-0c0bf896d505">
<parameter name="ruta" class="java.lang.String"/>
<field name="CodigoCama" class="java.lang.String"/>
<field name="Documento" class="java.lang.String"/>
<field name="Nombre" class="java.lang.String"/>
<field name="Edad" class="java.lang.String"/>
<field name="Empresa" class="java.lang.String"/>
<field name="Especialista" class="java.lang.String"/>
<field name="Diagnostico" class="java.lang.String"/>
<field name="FechaIngreso" class="java.lang.String"/>
<field name="Dias" class="java.lang.String"/>
<field name="Dieta" class="java.lang.String"/>
<field name="Observaciones" class="java.lang.String"/>
<field name="Registrado" class="java.lang.String"/>
<field name="FechaRegistro" class="java.lang.String"/>
<variable name="totalPaginas" class="java.lang.Integer" resetType="Page" incrementType="Report" calculation="Count"/>
<title>
<band height="58" splitType="Stretch">
<rectangle>
<reportElement uuid="df0fa9dd-b7f1-4800-b1bf-f40de1bc7263" x="64" y="1" width="1801" height="50" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f773ff3c-e683-41f4-8f16-7d8c66d54562" mode="Opaque" x="64" y="2" width="1801" height="48" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="20" isBold="true"/>
</textElement>
<text><![CDATA[CENSO DIARIO]]></text>
</staticText>
<rectangle>
<reportElement uuid="07b7d0a3-0b20-4649-a1b2-0045ca40372e" x="1" y="1" width="63" height="50" backcolor="#E0E0E0"/>
</rectangle>
<rectangle>
<reportElement uuid="e076ba71-8906-4238-a19d-f75077425de6" x="1865" y="1" width="134" height="50" backcolor="#E2DEDE"/>
</rectangle>
<image hAlign="Center" vAlign="Middle">
<reportElement uuid="e0c8b5d2-3f68-4895-adea-e98d58a2ea3e" x="1" y="2" width="63" height="47"/>
<imageExpression><![CDATA[$P{ruta}+"//img//LOGO1.png"]]></imageExpression>
</image>
<image hAlign="Center" vAlign="Middle">
<reportElement uuid="ce929fc5-57d6-4e20-b30c-9893f34edf61" x="1901" y="3" width="58" height="46"/>
<imageExpression><![CDATA[$P{ruta}+"//img//100calidad.jpg"]]></imageExpression>
</image>
</band>
</title>
<pageHeader>
<band height="24" splitType="Stretch">
<rectangle>
<reportElement uuid="b28a6cd6-7bb8-4332-a443-795537750291" x="0" y="8" width="1629" height="16" backcolor="#D3ECC7"/>
</rectangle>
<rectangle>
<reportElement uuid="da28e036-684a-4921-a42a-4afab1ff613a" x="1629" y="8" width="370" height="16" backcolor="#D3ECC7"/>
</rectangle>
<staticText>
<reportElement uuid="4ec9e82c-884b-49ea-9d84-41ef79374f2d" mode="Opaque" x="1632" y="10" width="360" height="14" backcolor="#D3ECC7"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Información del Empleado]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="23" splitType="Stretch">
<rectangle>
<reportElement uuid="0ed0631b-b8b3-4544-984a-6a8b152405a4" x="145" y="1" width="169" height="22" backcolor="#E0E0E0"/>
</rectangle>
<rectangle>
<reportElement uuid="5d9afa11-5f66-4c24-a689-790b6bbbfee8" x="0" y="1" width="52" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="d3cbfe71-89c2-40f4-83be-c388d60d1f57" mode="Transparent" x="10" y="0" width="39" height="22" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Cama]]></text>
</staticText>
<rectangle>
<reportElement uuid="6e7ec76b-c44c-4ae1-8b14-868e9f596876" x="314" y="1" width="35" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="afc00f8f-d646-48be-b883-11beb5e4e5b3" x="318" y="1" width="25" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Edad]]></text>
</staticText>
<rectangle>
<reportElement uuid="065d81fe-b21e-4982-9843-c874f499a969" x="349" y="1" width="150" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="1215c9ac-9bc5-428d-9456-4c9c0ce81129" x="351" y="1" width="145" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Empresa]]></text>
</staticText>
<rectangle>
<reportElement uuid="9066f537-b0d4-4a43-b544-14704b4fc207" x="499" y="1" width="150" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="6ba919d0-8dc8-421e-890d-4d9e9bcdf639" x="501" y="1" width="146" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Especialista]]></text>
</staticText>
<rectangle>
<reportElement uuid="efeb1184-587c-43ce-bca3-3e6b25f10ea6" x="649" y="1" width="206" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="bc197cfe-a855-4da3-b25e-2d602e16e5c5" x="670" y="1" width="164" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Diagnostico]]></text>
</staticText>
<rectangle>
<reportElement uuid="b9dadc2e-8f0d-481d-a82d-f6f47263ef18" x="855" y="1" width="209" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="7c51754f-552c-445e-b7f4-668375f96f3b" x="868" y="1" width="183" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Fecha Ingreso Paciente]]></text>
</staticText>
<rectangle>
<reportElement uuid="efe37924-5b8b-46bb-b7ab-c35ec15f16f7" x="1173" y="1" width="156" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="4360b926-3429-4bcf-bf76-28c6ed3af80f" x="1219" y="1" width="65" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dieta]]></text>
</staticText>
<rectangle>
<reportElement uuid="53b0b7be-341c-4d88-9d06-e9ce66f2ba38" x="1329" y="1" width="300" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="739a0a28-415c-4f19-97e7-0eb4d1967f0c" x="1346" y="1" width="269" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Observaciones]]></text>
</staticText>
<rectangle>
<reportElement uuid="5c0eb8ea-abbb-430f-8faf-bdc507ccdc43" x="1064" y="1" width="109" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f620ed1e-a0a1-448f-a9cd-13b0824dda53" x="1064" y="1" width="98" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dias Estancia]]></text>
</staticText>
<rectangle>
<reportElement uuid="f0ac1173-7313-46cb-bf0c-072abc746810" x="1629" y="1" width="250" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f0650ba4-1a18-4ff8-b514-928fad9c0e47" x="1629" y="1" width="250" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Registrado Por]]></text>
</staticText>
<rectangle>
<reportElement uuid="ea2a4a77-fe25-4b62-8730-b04158cc4f43" x="1879" y="1" width="120" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="051cd84a-f45a-43ae-8e50-476a1723acdd" x="1879" y="1" width="120" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Fecha Registro]]></text>
</staticText>
<rectangle>
<reportElement uuid="146c7aa0-b3cd-496d-a9c7-49b74c37bd64" x="52" y="1" width="93" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f657cfd7-da85-4e30-86ec-720183dbd38b" mode="Transparent" x="52" y="1" width="93" height="22" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Documento]]></text>
</staticText>
<staticText>
<reportElement uuid="64287559-c995-45ba-b97f-dbfbecf62eab" mode="Transparent" x="145" y="2" width="169" height="21" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Nombre(s) y Apellidos]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="626" splitType="Stretch">
<rectangle>
<reportElement uuid="ce513dc9-595a-4018-9b60-4184a87400cf" x="52" y="0" width="93" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="633a32fe-76d0-478c-a2e8-ef73630b698d" x="0" y="0" width="52" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="d1b97bd4-4e00-4aae-a0eb-d9532314933f" x="3" y="0" width="46" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{CodigoCama}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="58f022c4-755c-4341-9de7-152dbb01092b" x="145" y="0" width="169" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="9236e426-7562-40b9-8c87-02a31d29dacf" x="314" y="0" width="35" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="d77071b7-c1cc-40e8-ab57-92ad08278390" x="316" y="0" width="29" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Edad}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="76fa21b9-c41d-46bc-8c50-dee329b8c61c" x="349" y="0" width="150" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="81c4e8ba-6de5-471d-b8ca-3e9984105a99" x="354" y="0" width="140" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Empresa}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="836b0a1d-4268-4668-a63e-4df1b4834662" x="499" y="0" width="150" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="e0ee8d88-5ef1-4e7e-b534-c5cef786c942" x="505" y="0" width="140" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Especialista}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="49535787-c02d-4d34-9b83-ed192e0fb086" x="855" y="0" width="209" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="0a4641d9-76f8-4081-ba53-7d68e9934176" x="865" y="0" width="190" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{FechaIngreso}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="e4187b85-1c21-4041-8e0e-2c1a6f02cb72" x="1173" y="0" width="156" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="7883fd8a-e3f2-4930-8ec0-37fdb76f4fa4" x="1184" y="0" width="132" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Dieta}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="1a80ef21-1caa-46c2-a1ff-69a810997625" x="1329" y="0" width="300" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="cb697e3d-c8e0-4c98-a588-1eb92008d1f5" x="1345" y="0" width="269" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Observaciones}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="6e960357-27ac-4411-b0ab-1dc6c2bc101b" x="1064" y="0" width="109" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="3eca5ca2-a90b-4c1c-96d4-2ff47b699044" x="1879" y="0" width="120" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="548dcabc-6708-4a4b-902a-7fd7cc30f26c" x="1897" y="0" width="93" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{FechaRegistro}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="2cc8851f-d3b4-44cf-a97c-4ad7544765b5" x="59" y="0" width="79" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Documento}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="641978c2-69fc-45f3-a96c-25a53aa138b5" x="1629" y="0" width="250" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="66b12f81-615c-4bb7-8c18-3ce2f0e877d6" x="1635" y="0" width="236" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Registrado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="0a4641d9-76f8-4081-ba53-7d68e9934176" x="1069" y="1" width="98" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Dias}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="8e458e73-d0fb-4707-b4b8-dd34642725af" x="151" y="1" width="155" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Nombre}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="e021e007-7a56-4ebe-a617-ab39f21dbb32" x="649" y="0" width="206" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="61d0b9e9-f314-44a3-8aa4-ead1d3e726b6" x="659" y="0" width="185" height="58"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Diagnostico}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="140" splitType="Stretch"/>
</pageFooter>
</jasperReport>
I tried with a page break but I got the same result.
Your detail band is too tall. Set its height to match the tallest element in the band, that is 59 pixels.
I am using jasper report in my liferay custom portlet and i designed my report with ireport 4.7.1 but my problem is why there is vast diffrence in the reports generated with html and with pdf..there is lots of diffrence in rows of reports in html format and pdf format..how can i make both the html and pdf report generated from same jasper file as identical.?i mean with same look and feel..
following are my snippet of html and pdf report
HTML REPORT
PDF REPORT
following is my jrxml file from which i generate .jasper and then generating above two result.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Campaign_Advertise_DateRange_Report" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true">
<property name="ireport.zoom" value="0.9090909090909098"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Table Dataset 1"/>
<field name="advertisename" class="java.lang.String"/>
<field name="camp_name" class="java.lang.String"/>
<field name="ad_location" class="java.lang.String"/>
<field name="clicked" class="java.lang.Integer"/>
<field name="impression" class="java.lang.Integer"/>
<field name="filter_start_date" class="java.util.Date"/>
<field name="filter_end_date" class="java.util.Date"/>
<variable name="CamapignTotal" class="java.lang.Integer" resetType="Group" resetGroup="Campaign Name" calculation="Sum">
<variableExpression><![CDATA[$F{impression}]]></variableExpression>
</variable>
<variable name="CampaignGrandTotal" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{impression}]]></variableExpression>
</variable>
<group name="Campaign Name">
<groupExpression><![CDATA[$F{camp_name}]]></groupExpression>
<groupFooter>
<band height="21">
<textField pattern="" isBlankWhenNull="true">
<reportElement style="table_TD" x="419" y="0" width="86" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{CamapignTotal}]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="table_TD" x="346" y="0" width="73" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Group Total :]]></text>
</staticText>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="114">
<staticText>
<reportElement x="136" y="24" width="283" height="67"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="32" isUnderline="true"/>
</textElement>
<text><![CDATA[Campaign Reports]]></text>
</staticText>
<staticText>
<reportElement x="0" y="2" width="30" height="20"/>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<text><![CDATA[Date : ]]></text>
</staticText>
<textField pattern="MM/dd/yyyy">
<reportElement x="30" y="2" width="100" height="20"/>
<textElement textAlignment="Justified">
<font fontName="Times New Roman" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="94" width="30" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[From:]]></text>
</staticText>
<staticText>
<reportElement x="136" y="94" width="19" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[To:]]></text>
</staticText>
<textField>
<reportElement x="30" y="94" width="96" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{filter_start_date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="155" y="94" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{filter_end_date}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="419" y="94" width="131" height="20"/>
<textElement textAlignment="Right">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Advertise Display Reports]]></text>
</staticText>
<image>
<reportElement x="458" y="8" width="92" height="53"/>
<imageExpression><![CDATA["D:\\Liferay\\liferay-plugins-sdk-6.1.1-ce-ga2-20120731132656558\\liferay-plugins-sdk-6.1.1\\portlets\\eMenuAdvertise-portlet\\docroot\\img\\eMenuLogo.png"]]></imageExpression>
</image>
</band>
</title>
<pageHeader>
<band height="52">
<staticText>
<reportElement style="table_TD" mode="Transparent" x="0" y="31" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Advertise Name]]></text>
</staticText>
<staticText>
<reportElement style="table_TD" mode="Transparent" x="346" y="31" width="73" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Clicked]]></text>
</staticText>
<staticText>
<reportElement style="table_TD" mode="Transparent" x="250" y="31" width="96" height="20" isPrintInFirstWholeBand="true"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[AD Location]]></text>
</staticText>
<staticText>
<reportElement style="table_TD" mode="Transparent" x="100" y="31" width="150" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Campaign Name]]></text>
</staticText>
<staticText>
<reportElement style="table_TD" mode="Transparent" x="419" y="31" width="86" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Impression]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="21" splitType="Immediate">
<textField>
<reportElement style="table_TD" mode="Transparent" x="0" y="-1" width="100" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression><![CDATA[$F{advertisename}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TD" mode="Transparent" x="250" y="-1" width="96" height="22" backcolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression><![CDATA[$F{ad_location}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TD" mode="Transparent" x="419" y="-1" width="86" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression><![CDATA[$F{impression}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TD" mode="Transparent" x="100" y="-1" width="150" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression><![CDATA[$F{camp_name}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TD" mode="Transparent" x="346" y="-1" width="73" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression><![CDATA[$F{clicked}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="50">
<staticText>
<reportElement style="table_TD" x="346" y="0" width="73" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Grand Total :]]></text>
</staticText>
<textField isBlankWhenNull="false">
<reportElement style="table_TD" x="419" y="0" width="86" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{CampaignGrandTotal}]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
</jasperReport>
Can any one help me out to make both reports look and feel same ?
The problem in your report seems to be the height of the elements in the Detail Band, they're 22 pixels, and the band is 21, also their top property is -1, i recommend you to make the band bigger (or your controls smaller) and set the Top property to 0, or any positive value.