我正在使用TIBCOJaspersoft®Studio 6.6.0。
具有 rowSpan> 1 (表元素)的列标题上存在高度拉伸问题。
每当标题内的任何文本元素拉伸列高时都会发生(isStretchWithOverflow = true)。
请注意,第二个标题行没有任何拉伸文本元素,但是其高度调整与第一个标题行相对应。
我尝试了一组参数 stretchType 的组合(例如RelativeToTallestObject,RelativeToBandHeight,ElementGroupHeight),但似乎都不起作用...
有人可以帮助我吗?
表格截图:
Jaspersoft报告代码:
<?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="ppc_book_content_code" pageWidth="455" pageHeight="842" columnWidth="455" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="386730d6-f5ad-473d-8f27-9e43f0453054">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Table_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Tabela3DataSet" uuid="56b71c07-bf1b-40de-b28e-b2844339a868">
<field name="dados_2" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_2"/>
</field>
<field name="dados_3" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_3"/>
</field>
<field name="dados_0" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_0"/>
</field>
<field name="dados_1" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_1"/>
</field>
</subDataset>
<subDataset name="Tabela1DataSet" uuid="d4c004db-069c-4149-9217-ec6402ef6b1d">
<field name="dados_2" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_2"/>
</field>
<field name="dados_3" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_3"/>
</field>
<field name="dados_0" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_0"/>
</field>
<field name="dados_1" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_1"/>
</field>
<field name="dados_4" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_4"/>
</field>
<field name="dados_5" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_5"/>
</field>
</subDataset>
<subDataset name="Tabela2DataSet" uuid="90b093a1-1bef-475f-b35e-ed0862b2c1e6">
<field name="dados_2" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_2"/>
</field>
<field name="dados_3" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_3"/>
</field>
<field name="dados_0" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_0"/>
</field>
<field name="dados_1" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_1"/>
</field>
<field name="dados_4" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="dados_4"/>
</field>
</subDataset>
<subDataset name="Lista2DataSet" uuid="c6f076ab-05b0-43c2-aec0-5c45c2515994">
<field name="item" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="item"/>
</field>
<field name="numerador" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="numerador"/>
</field>
<field name="nivel" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="nivel"/>
</field>
</subDataset>
<subDataset name="Lista1DataSet" uuid="00469e63-1187-4ad7-89e7-425a37724656">
<field name="item" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="item"/>
</field>
<field name="numerador" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="numerador"/>
</field>
<field name="nivel" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="nivel"/>
</field>
</subDataset>
<subDataset name="Lista3DataSet" uuid="9ab51d92-6264-4053-8c06-ed6687d31725">
<field name="item" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="item"/>
</field>
<field name="numerador" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="numerador"/>
</field>
<field name="nivel" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="nivel"/>
</field>
</subDataset>
<parameter name="jsonTableDataSource" class="net.sf.jasperreports.engine.data.JsonDataSource"/>
<parameter name="jsonListDataSource" class="net.sf.jasperreports.engine.data.JsonDataSource"/>
<detail>
<band height="285" splitType="Stretch">
<componentElement>
<reportElement positionType="Float" x="0" y="45" width="455" height="115" uuid="b3d5b867-3238-4832-81c5-cc84d3148b0e"/>
<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="Tabela1DataSet" uuid="bdabb9e6-67f2-4d6d-87c9-299837c86ae9">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{jsonTableDataSource}.subDataSource("Tabela1")]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:columnGroup width="81" uuid="8dcb5da9-503e-4ad5-8797-98ed020b9f44">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableHeader style="Table_CH" height="30" rowSpan="2">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="81" height="30" uuid="6dbe2d18-eaeb-437f-aeb6-3e31a81816df"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" Row Span 2"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:column width="81" uuid="c8f3c569-43c7-459c-b4ee-e43f3a18e91a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1_1"/>
<jr:tableHeader style="Table_CH" height="0" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="81" height="15" uuid="387258e6-cd2a-4e9a-a5e4-9f91230306d7"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_0}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
<jr:columnGroup width="118" uuid="1733ebc9-44e4-4843-a1d9-0bb1ddc88330">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="118" height="15" uuid="4999497b-234d-43e5-b858-b136434888a1"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:column width="59" uuid="49a3d1a0-8042-425c-9fd1-24a6c969dfab">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2_1"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="59" height="15" uuid="7ff4a723-857e-47f3-b0c9-de605632ed9d"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["No Stretch "]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="59" height="15" uuid="1c849ad4-7b75-4c4e-9eed-4725e5d8eb5b"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_1}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="59" uuid="3af1369e-7834-4e03-9121-bdccfe010049">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2_2"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="59" height="15" uuid="4db8bab1-fde3-46f0-a1d6-1334641730bb"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="59" height="15" uuid="1e7d2362-478b-4d77-81b1-d87d89a01b65"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_2}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
<jr:columnGroup width="63" uuid="c9a2d599-c2fb-4a61-8976-535f45d2e565">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="258755e0-fff7-48a0-b4d8-5da28c21dba6"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:column width="63" uuid="a0d4fe75-0c01-4262-93fb-ecdfb66f93f3">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3_1"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="f8b17fda-9447-4b4a-a31e-3c4e1def562a"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="73b97555-3c9e-4946-a320-5f5bce4294ef"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
<jr:columnGroup width="63" uuid="fa22aebb-dad0-4b9d-b10c-1dcbf0d8c608">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="f2db1b11-fd6a-4793-aef5-fbac2f2d7370"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Stretch Stretch Stretch Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:column width="63" uuid="6e6f7578-a6f0-48b8-b455-03009ad10c75">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4_1"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="e435e433-409e-4936-ae52-e0f03b32e30f"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="63" height="15" uuid="d97c7051-f7ca-40d6-8f63-d56421f4e0ed"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_4}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
<jr:columnGroup width="77" uuid="33fa3eec-a6b9-4b8b-adbf-25599f9a85a3">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="77" height="15" uuid="fc298e23-f425-4bae-8774-421ff454ad14"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:column width="77" uuid="894a7f5f-8f45-40b3-a742-1394b34889bc">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5_1"/>
<jr:tableHeader style="Table_CH" height="15" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="77" height="15" uuid="2e901538-af43-4bde-831b-01c5ed25964d"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[" No Stretch"]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="Table_TD" height="15">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="77" height="15" uuid="b52af4d1-49b9-49f6-8188-1ed6d5bb5e7d"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dados_5}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>