Jump to content

Problem with stretch


diegocardoso

Recommended Posts

 I'm developing one report wich has two sub-reports placed side-by-side as columns. The problem that I've got is that when one subreport is taller than the other (wich is expected to occurs always), the smaller one doesn't stretch. Both stretch types are set as "Relative to Band Height" and they don't work when I set as "Relative to Tallest Object" either.

Each sub-report has the same structure: a column header, a group header, and a column footer. I don't know if I have to set an object in each sub-report to stretch when the other one gets taller.

Any help is welcome!

 

Thanks.



Post Edited by diegocardoso at 10/30/2010 17:36
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Stretch type of "Relative to Tallest Object" will only work with subreports if they have a background color set and the "Opaque" setting is TRUE.  Even then the stretch won't extend beyond one page, so it's not a great solution.

Since each subreport is evaluated independently it is not possible to exchange information between them about how many rows are being returned.

However, you can put a subreport into the page header that returns the count of rows for each query.  Those values could then be used to make decisions about how to adjust the output of the subreports.  Just how you would do that is up to you.

But the easiest way to overcome you problem is to use ONE subreport with one query.  Format the subreport to output the information as if there were two.  Use printWhenExpression if necessary to remove objects when your query returns NULLs, empty strings, zeroes etc.

Link to comment
Share on other sites

  • 6 years later...
Hello to all
I have a problem
I do not want this line to start on a new page.
How i cand do this.????

jrmxl file look like this:
 
<detail>
<band height="564" isSplitAllowed="true" splitType="Stretch">
 
 
 
 
<componentElement>
 
<reportElement key="table 1"  x="13" y="265" positionType="Float"  width="530" height="15"/>
<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="t2_eval">
<datasetParameter name="p_id_eval">
<datasetParameterExpression><![CDATA[$P{p_id_eval}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="31">
 
<jr:columnHeader  style="table" height="29" rowSpan="1">
 
<staticText>
<reportElement stretchType="RelativeToBandHeight"  mode="Opaque" x="2" y="2" width="28" height="25" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[Nr.
crt.]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21"  rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement  stretchType="RelativeToBandHeight" x="0" y="0" width="31" height="20"/>
<textElement verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement >
<textFieldExpression><![CDATA[$F{NRCRT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="115">
<jr:columnHeader style="table" height="29" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="1" y="1" width="113" height="26" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[Obiective individuale
de activitate]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="1" y="1" width="113" height="20"/>
<textElement verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{OBJECTIVE_NAME}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="112">
<jr:columnHeader style="table" height="29" rowSpan="1">
<staticText>
<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="2" y="2" width="108" height="26" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[indicatori de
performanță]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="112" height="21"/>
<textElement verticalAlignment="Middle" markup="styled">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{PERFORMANCE_INDICATOR}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="101">
<jr:columnHeader style="table" height="29" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="2" y="2" width="98" height="26" stretchType="RelativeToBandHeight" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[Nivel de îndeplinire,
în %]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="101" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{OBJECTIVE_LEVEL}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="110">
<jr:tableFooter height="30" rowSpan="1">
<staticText>
<reportElement stretchType="RelativeToBandHeight" style="table" mode="Opaque" x="0" y="0" width="110" height="30" backcolor="#F2F2F2"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10" rightIndent="5"/>
</textElement>
<text><![CDATA[Media aritmetică:]]></text>
</staticText>
</jr:tableFooter>
<jr:columnHeader style="table" height="29" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="2" y="2" width="107" height="26" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[Comentarii]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="110" height="21"/>
<textElement verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{OBJECTIVE_COMMENTS}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="60">
<jr:tableFooter height="30" rowSpan="1">
<textField evaluationTime="Column" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement style="table" x="0" y="0" width="60" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{score_avg}]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:columnHeader style="table" height="29" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="2" y="2" width="56" height="26" backcolor="#F2F2F2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="true" isStrikeThrough="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="2"/>
</textElement>
<text><![CDATA[Punctaj stabilit 1)]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table" height="21" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="60" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="RomanCyrillic" isBold="false" isItalic="false" pdfEncoding="Identity-H"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{OBJECTIVE_SCORE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
 
 
 
 
 
</band>
 

</detail>
saveeee(1).thumb.PNG.3b702ba12904360c7eb35d75e649c6d6.PNG

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...