0

I have a jasper report created on Jasper studio 5.6.2. It has dynamic text-field which displays string comments from a list of string. The pdf report generated has the comments height fixed even though the number of words in comments are either 10 or 10000. I thought my below approach would display shorter or minimum height="80" for 10 words and will be dynamic or increase height if number of words increases.

My jrxml file

<subDataset name="Dataset2" uuid="b6a2d9e6-7689-4fe6-a101-5298242aadf6">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter "/>

    <queryString language="SQL">
        <![CDATA[]]>
    </queryString>
    <field name="_THIS" class="java.lang.String">
        <fieldDescription><![CDATA[_THIS]]></fieldDescription>
    </field>
</subDataset>
   .....
    <detail>
        <band height="550" splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <componentElement>
                <reportElement key="" isPrintRepeatedValues="false" x="0" y="0" width="572" height="550" isRemoveLineWhenBlank="true" uuid="ba9c4d45-37c6-43cf-be92-a0be635bd27d">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
                </reportElement>
                <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" whenNoDataType="AllSectionsNoDetail">
                    <datasetRun subDataset="Dataset2" uuid="d3156b50-4ed0-493c-85fe-68885a491427">
                        <datasetParameter name="comments">
                            <datasetParameterExpression><![CDATA[$P{commentList}]]></datasetParameterExpression>
                        </datasetParameter>
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{commentList})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:column width="572" uuid="d2b39095-d113-461a-989e-ee62f0d7217c">
                        <property name="local_mesure_unitwidth" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                        <jr:columnHeader style="Style1" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="572" height="30" uuid="a0ef8f95-951f-4518-988a-16b5f3c4b078"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font fontName="DejaVu Sans" isBold="true"/>
                                </textElement>
                                <text><![CDATA[COMMENTS]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="Table 2_TD" height="80">
                            <textField isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="572" height="80" uuid="2cd9fc51-8cc5-46cd-b917-a33a91521417">
                                    <property name="local_mesure_unitheight" value="pixel"/>
                                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                                </reportElement>
                                <textElement>
                                    <font fontName="DejaVu Sans" size="10"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$F{_THIS}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>

What am I doing wrong? Why the comment height remains same even if the number of words varies?

Alex K
  • 22,315
  • 19
  • 108
  • 236
likeGreen
  • 1,001
  • 1
  • 20
  • 40

0 Answers0