2014-07-16 63 views
0

我正在使用iReport。我想知道如何製作一個自動高度矩形? enter image description here自動高度矩形詳細帶

根據此詳細帶的示例圖像。數據顯示的右側有兩部分是數據部分。左側部分是作爲參數傳遞的textarea數據。 我想使兩個矩形高度相同。有可能左側數據高度大於右側部分,反之亦然。所以我想讓所有的矩形高度都一樣。

爲了達到這個我使用下面的代碼。在那裏我不使用長方形,但只有一條線

<columnHeader> 
      <line> 
      <reportElement x="0" y="28" width="555" height="1" uuid="9d2cb019-77f2-47a0-94f7-aa944b5c277e"/> 
     </line> 
    </band> 
</columnHeader> 

    <detail> 
    <band height="13" splitType="Stretch"> 
     <textField> 
      <reportElement x="472" y="0" width="50" height="13" uuid="4b51d986-b6f9-45e2-a151-e9d7f86007f3"/> 
      <textElement textAlignment="Right" verticalAlignment="Middle"> 
       <font fontName="DejaVu Sans" size="8" pdfEncoding="Identity-H" isPdfEmbedded="true"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{packing}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="526" y="0" width="27" height="13" uuid="930cf91c-710a-40c4-a899-fde5ddfd7ce4"/> 
      <textElement verticalAlignment="Middle"> 
       <font fontName="DejaVu Sans" size="8" pdfEncoding="Identity-H" isPdfEmbedded="true"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{sli_pack}]]></textFieldExpression> 
     </textField> 
     <line> 
      <reportElement x="471" y="0" width="1" height="13" uuid="434d1954-3286-4539-a3d9-915f28364210"/> 
     </line> 
     <line> 
      <reportElement x="555" y="-1" width="1" height="13" uuid="39dab81d-1bb3-41bd-8fff-9780b7f65672"/> 
     </line> 
     <line> 
      <reportElement x="0" y="-1" width="1" height="13" uuid="8936db56-872f-434d-a39b-298ffdb99e57"/> 
     </line> 
    </band> 
</detail> 
<summary> 
    <band height="1" splitType="Stretch"> 
     <line> 
      <reportElement x="0" y="-1" width="555" height="1" uuid="ba7dbcc7-fd20-4ee9-b593-480737f9b88c"/> 
     </line> 
    </band> 
</summary> 

但是這種方式的問題是矩形的角落沒有正確打印。

我的問題是:

1)有沒有更好的方式來做到這一點?

2)如何繪製完整細節帶的邊框?

3)如何用矩形做到這一點?

這裏是另一個圍繞細節帶矩形的嘗試,但矩形會重複到每一行。

<detail> 
    <band height="13" splitType="Stretch"> 
     <rectangle> 
      <reportElement stretchType="RelativeToTallestObject" x="1" y="0" width="552" height="13" uuid="80b946be-ac5f-495d-a507-fec3e22ea751"/> 
     </rectangle> 
     <textField> 
      <reportElement x="465" y="0" width="50" height="13" uuid="4b51d986-b6f9-45e2-a151-e9d7f86007f3"/> 
      <textElement textAlignment="Right" verticalAlignment="Middle"> 
       <font fontName="DejaVu Sans" size="8" pdfEncoding="Identity-H" isPdfEmbedded="true"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{packing}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="526" y="0" width="27" height="13" uuid="930cf91c-710a-40c4-a899-fde5ddfd7ce4"/> 
      <textElement verticalAlignment="Middle"> 
       <font fontName="DejaVu Sans" size="8" pdfEncoding="Identity-H" isPdfEmbedded="true"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{sli_pack}]]></textFieldExpression> 
     </textField> 
    </band> 
</detail> 

回答

0

我想你應該有一個矩形,並在兩者之間放置一條線。使用line的屬性,檢查stretchWithOverflow爲true。 Simillarly與矩形。

+0

我應該在哪裏放長方形?詳細樂隊?我先試了一下,但每次都重複錄製 –

+0

是的詳細樂隊。 –

+0

每行的矩形重複 –