I use traditional Chinese ,and set the Stretch with overflow.
I find the Jasper report lose some characters like above picture when it would create a new line.
my jrxml text :
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="352" y="0" width="140" height="30" isPrintWhenDetailOverflows="true" uuid="9855b06a-dfca-4a88-8830-efb1590c2d4e"/>
<box topPadding="1" leftPadding="4" bottomPadding="5" rightPadding="4">
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="標楷體" pdfFontName="MHei-Medium" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1"/>
</textElement>
<textFieldExpression><![CDATA[$F{varyReason}]]></textFieldExpression>
</textField>
Do I lose some setting???
Related
<staticText>
<reportElement x="100" y="0" width="100" height="25" backcolor="#A6A6A6" />
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Nom]]></text>
</staticText>
I need to change the background color, i tried the attribute " backcolor="#A6A6A6" " but it it doesn't work!
You also need to set mode="Opaque".
I am using jasperreports 6.6.0. In the report i have a jsonqldatasource with list of lists and i need to print the values in a table structure. In detail band there are few "columns" of frames(with borders) that are printed correctly on one page. But when one of columns is stretched to the next page than only that column borders are stretched along with text. What i need is printing borders of all "columns" if one of them is stretched to the next page.
I will attach jrxml and some screenshots(https://imgur.com/a/SNa2Ckw) to better explain the question. I've highlighted missing borders with green colour on second image
<detail>
<band height="70" splitType="Stretch">
<frame>
<reportElement positionType="Float" x="38" y="10" width="505" height="60" uuid="41dea29f-7812-4ee4-a523-05ff19d28142">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<frame>
<reportElement positionType="Float" x="-3" y="30" width="499" height="31" uuid="eda5c6aa-fa84-4531-b8cb-8f3e6824be58">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box leftPadding="0" bottomPadding="0" rightPadding="0"/>
<frame>
<reportElement x="0" y="0" width="80" height="30" uuid="188be56c-2c0e-40bb-9c79-9d9767c06c95"/>
<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="3" y="0" width="77" height="30" uuid="6f72763f-f3ad-43ca-abac-bbeaf2d8f2e6">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{documentTitle}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="80" y="0" width="60" height="30" uuid="90b690e7-b9c1-47a6-a55e-3d0f90eb9f80"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="4" y="0" width="56" height="30" uuid="eb3e7b8d-ef93-40ba-988a-f4f647441ae0">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{dateTitle}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="140" y="0" width="134" height="30" uuid="c9d19eb6-a488-4fbe-b477-cd554f76d93d"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="3" y="0" width="131" height="30" uuid="17aef305-9bdb-4b90-8333-e100c125b0cd">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{corespondentTitle}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="274" y="0" width="40" height="30" uuid="2154fc22-c2c0-49e4-b3d0-3f4328577e49"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="0" y="0" width="40" height="30" uuid="8f838cba-7ea2-49d8-a212-a27e7388049a">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{oborotDtTitle}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="314" y="0" width="40" height="30" uuid="3b1b29ca-b0f9-49d8-b4ea-585682ffe1dd"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="0" y="0" width="40" height="30" uuid="649f0ba5-35f3-473d-9953-3cb6b5cf40c3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{oborotKtTitle}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="354" y="0" width="145" height="30" uuid="ea45a53d-5f82-46f0-b5b8-040a4b03dba4"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement positionType="Float" x="3" y="0" width="135" height="30" uuid="92ce4c0a-af9b-4f73-bce2-bc3ade6843e3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$P{purposeTitle}]]></textFieldExpression>
</textField>
</frame>
</frame>
</frame>
</band>
<band height="120">
<property name="com.jaspersoft.studio.layout"/>
<printWhenExpression><![CDATA[$F{accountNumber}!=null]]></printWhenExpression>
<frame>
<reportElement positionType="Float" stretchType="ContainerHeight" mode="Transparent" x="35" y="0" width="499" height="100" isRemoveLineWhenBlank="true" uuid="7209f70f-f728-4e6c-a904-b8af7ec3c470">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="ShowOutOfBoundContent" value="true"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<componentElement>
<reportElement stretchType="ContainerBottom" mode="Transparent" x="0" y="0" width="499" height="100" isRemoveLineWhenBlank="true" uuid="22033e7e-bcfa-4636-9ee9-0d5657a11fd7">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</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" ignoreWidth="false">
<datasetRun subDataset="TransactionInfoDataset" uuid="09f940cf-bcc1-4997-af19-470c1e210390">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("content.transactionsInfo")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="100" width="499">
<frame borderSplitType="DrawBorders">
<reportElement stretchType="ElementGroupHeight" x="0" y="60" width="499" height="40" uuid="dbbb9bb0-b7e8-4b7f-933b-bb424934432e"/>
<box>
<topPen lineStyle="Solid" lineColor="#000000"/>
<leftPen lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineStyle="Solid" lineColor="#000000"/>
<rightPen lineStyle="Solid" lineColor="#000000"/>
</box>
<componentElement>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="499" height="40" isRemoveLineWhenBlank="true" uuid="1a9c9a78-443f-4fb2-9e50-e4764b3bbd84">
<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"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<jr:list printOrder="Vertical" ignoreWidth="true">
<datasetRun subDataset="TransactionDataset" uuid="3af1a5b8-e298-4fd3-bc5a-856082e2fab8">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("transactions")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="40" width="499">
<frame borderSplitType="DrawBorders">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="499" height="40" uuid="8230fd0b-2e3d-4dfc-b1af-338a150c995c">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box leftPadding="0" bottomPadding="0" rightPadding="0"/>
<frame>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="80" height="40" uuid="44a98fd7-e9fb-4ad0-ab91-1061a4946c4c"/>
<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="3" y="0" width="77" height="30" uuid="94aa871f-31eb-4e73-8bd3-b7bb81d00dd9">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{orderName} +" № " + $F{orderNumber} +" \nот " +$F{orderDate}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement stretchType="ElementGroupHeight" x="80" y="0" width="60" height="40" uuid="b2e673ca-a3ee-476c-9f5f-619bad0c38f0"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="2" y="0" width="58" height="30" uuid="72bef5d8-674b-46fb-994b-3057a1988a7e">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{orderDate}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement stretchType="ElementGroupHeight" x="140" y="0" width="134" height="40" uuid="7bcaf153-ec36-47a5-adee-8c041a6ac2f6"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="3" y="0" width="129" height="30" uuid="62e0404d-7d0f-4f3f-b432-d2ee19f10de3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{payeeOwner} + ", счет № " + $F{payeeAccountNumber} + ", " +$F{payeeBankName}+ ", БИК " + $F{payeeBic}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement stretchType="ElementGroupHeight" x="274" y="0" width="40" height="40" uuid="bf3039f9-52f6-4624-929d-e8937ef0311b"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="40" height="30" uuid="dac65ed4-11a8-4ad1-8a61-3c6cc05c8226">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{debitAmount}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement stretchType="ElementGroupHeight" x="314" y="0" width="40" height="40" uuid="1303ec83-077b-4b38-888b-e99de6e3f4b6"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="40" height="30" uuid="d2783913-bb9d-4d9a-87bb-08bb46dbc740">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{creditAmount}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement stretchType="ElementGroupHeight" x="354" y="0" width="145" height="40" uuid="0abcb132-9c01-4f50-8e24-c804cf022938"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="4" y="0" width="136" height="30" isPrintWhenDetailOverflows="true" uuid="e2976bec-f09f-44ee-b4f6-2a34414d0a1e">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{purpose}]]></textFieldExpression>
</textField>
</frame>
</frame>
</jr:listContents>
</jr:list>
</componentElement>
</frame>
<frame borderSplitType="DrawBorders">
<reportElement x="0" y="0" width="499" height="60" uuid="a90a6869-35f1-4efd-83cf-acdc2f69ecf3"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<frame>
<reportElement x="0" y="0" width="100" height="60" isRemoveLineWhenBlank="true" uuid="1f8ccece-16e7-4059-bb08-82f27a51d038">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<pen lineColor="#2318F0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement key="" positionType="Float" x="0" y="0" width="100" height="60" uuid="a18919eb-db17-4cfa-9e26-5588c74405a7">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.spacingAfter" value="pixel"/>
<property name="com.jaspersoft.studio.unit.tabStopWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineColor="#38C241"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="100" y="0" width="100" height="60" isRemoveLineWhenBlank="true" uuid="aa836dd4-0a46-4ddf-aa11-a0fbb2250cc4">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<pen lineColor="#2318F0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement key="" positionType="Float" x="0" y="0" width="100" height="60" uuid="3300f017-3d51-430e-a687-d70406080c76">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.spacingAfter" value="pixel"/>
<property name="com.jaspersoft.studio.unit.tabStopWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineColor="#38C241"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA["Вх.\nостаток\n\n" + $F{incomingBalance}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="200" y="0" width="100" height="60" isRemoveLineWhenBlank="true" uuid="58db761a-82fb-48d1-bff2-9d23776dbaff">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<pen lineColor="#2318F0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement key="" positionType="Float" x="0" y="0" width="100" height="60" uuid="dffa0a44-0367-4083-99b3-4f613fd9d59f">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.spacingAfter" value="pixel"/>
<property name="com.jaspersoft.studio.unit.tabStopWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineColor="#38C241"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA["Оборот\nДт\n\n" + $F{debit}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="300" y="0" width="100" height="60" isRemoveLineWhenBlank="true" uuid="a0000b92-5dc9-415a-9872-0742b4e1767c">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<pen lineColor="#2318F0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement key="" positionType="Float" x="0" y="0" width="100" height="60" uuid="87d6d309-dd99-4b4a-98ce-ae830040f25e">
</reportElement>
<box>
<pen lineColor="#38C241"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA["Оборот\nКт\n\n" + $F{credit}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="400" y="0" width="99" height="60" isRemoveLineWhenBlank="true" uuid="ed2ef71e-09d8-4735-8bf9-fe1776cdf87a">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<pen lineColor="#2318F0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement key="" positionType="Float" x="0" y="0" width="99" height="60" uuid="54efcd3e-1ea4-48e9-91f5-648055807cab">
</reportElement>
<box>
<pen lineColor="#38C241"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12"/>
<paragraph lineSpacingSize="1.1" firstLineIndent="0"/>
</textElement>
<textFieldExpression><![CDATA["Исх.\nостаток\n\n" + $F{outgoingBalance}]]></textFieldExpression>
</textField>
</frame>
</frame>
</jr:listContents>
</jr:list>
</componentElement>
</frame>
</band>
</detail>
I want to make a table with dynamic headers for a PDF in Grails using Jasper. One of the possible solutions would be to have a property as a value for an xml attribute. I have a hard time explaining it in English,so maybe it's better to leave an example, here is the xml code for a static header in a table:
<staticText>
<reportElement x="29" y="183" width="118" height="32"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<text><![CDATA[Column header text]]></text>
</staticText>
What I want to know is, is it possible to have a parameter for the value of x, y and every other attribute value for the element, like for an example this:
<staticText>
<reportElement x="<![CDATA[$P{columnX}]]>" y="<![CDATA[$P{columnY}]]>" width="<![CDATA[$P{columnWidth}]]>" height=32/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<text><![CDATA[Column header text]]></text>
</staticText>
The parameter would be declared like this:
<parameter name="columnX" class="java.lang.Long"/>
I have texfield and a label i want to change the background color of label based on the value of texfield ,if the value of texfield is not null then the backcolor of label must change .
<style name="Color1">
<conditionalStyle>
<conditionExpression><![CDATA[$F{check1}=="0.00"]]></conditionExpression>
<style mode="Opaque" backcolor="#4F110F"/>
</conditionalStyle>
</style>
<textField isBlankWhenNull="true">
<reportElement x="140" y="50" width="34" height="24" backcolor="#4F110F" uuid="a792c8a7-ad7e-4f28-b8c0-cc0fce54030a"/>
<textFieldExpression><![CDATA[($F{check1} != null) ? $F{check1} : "0.00"]]></textFieldExpression>
</textField>
above is my texfield conditional expression for textfield
and below is the label
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="180" y="57" width="40" height="18" forecolor="#120808" backcolor="#FAFAFA" uuid="1f31c82f-cfca-4930-bee9-890c0dacca8d">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box topPadding="0" leftPadding="0">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Yes]]></text>
</staticText>
Try applying the "Color1" style to your StaticText element something like this:
<staticText>
<reportElement style="Color1" positionType="Float" ... >
...
</reportElement>
...
</staticText>
First Remove Forecolor,backcolor, mode from your label. and add your style to it.
<staticText>
<reportElement style="Color1" positionType="Float" stretchType="RelativeToBandHeight" x="180" y="57" width="40" height="18" uuid="1f31c82f-cfca-4930-bee9-890c0dacca8d">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box topPadding="0" leftPadding="0">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Yes]]></text>
</staticText>
If your condition, $F{check1} == "0.00" is not working. then try .equals property of java. $F{check1}.equals("0.00") or convert it into same datatype
like new BigDecimal($F{check1}) == new BigDecimal("0.00")
Some attribute character is coming in the next line.it should come in one line
Example:
Student looking like
Student
but name is looking like
nam
e
The code is
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="200" height="21" uuid="e3b2f0ba-d810-42d5-aad6-74b440e871c6"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0" lineStyle="Solid"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement>
<font fontName="SansSerif" size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>