views:

419

answers:

3

I have a textfield and a subreport in detail band. I pass the value to the subreport which displays details for the particular record. The problem is the textfield doesn't stretch when the subreport displays some value.

Here is a part of my jrxml with detail band:

<detail>
  <band height="40"  isSplitAllowed="true" >
    <textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
      <reportElement
        style="columnHeader"
        mode="Opaque"
        x="0"
        y="0"
        width="108"
        height="20"
        backcolor="#9999FF"
        key="groupMenu-1"/>
      <box></box>
      <textElement textAlignment="Center" verticalAlignment="Middle">
        <font pdfFontName="Helvetica-Bold" isBold="true" isPdfEmbedded ="false" pdfEncoding ="Cp1252"/>
      </textElement>
      <textFieldExpression   class="java.lang.String"><![CDATA[str("Code")]]></textFieldExpression>
    </textField>
    <subreport  isUsingCache="true">
      <reportElement
        mode="Transparent"
        x="0"
        y="39"
        width="100"
        height="1"
        key="subreport-1"
        stretchType="RelativeToTallestObject"
        positionType="Float"
        isPrintWhenDetailOverflows="true"/>
      <subreportParameter  name="requestListId">
        <subreportParameterExpression><![CDATA[$F{SPREADSHEET_REPORT_ID}]]></subreportParameterExpression>
      </subreportParameter>
      <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
      <subreportExpression  class="java.lang.String"><![CDATA[$P{subReportPath}]]></subreportExpression>
    </subreport>
  </band>
</detail>
A: 

Before you profile the jrxml, you can try (in iReport) right-click the textfield > Properties > Stretch type, and choose some of the two non-defaults (whichever fits your case, which I don't fully understand yet)

Bozho
I have done that, it works when there is no subreport within the same band, if there is a subreport within the band then it never stretches, instead the subreport fits in.
stanley
Try setting the positionType of the subreport to "float"
Bozho
A: 

I'm not sure if this is possible, the textfield when stretching does not push the subreport. But you can handle that in other methods.

  • Why not make a group band over the "Detail" band and set this group expression to $F{CODE} so the group will be rendered each time the code changes and at the same time the Detail band related to this code will be rendered directly after it

  • Second option, why not to send the CODE as a parameter to the subreport and put it in the report header?

medopal
A: 

you mean have the field stretch down as more data fills it?

I think that is what isStretchWithOverflow="false" is for. Just make it true instead of false.

I may not understand what you are asking though :)

Arthur Thomas