2013-03-30 81 views
0

我正在使用JasperReports作为Web应用程序的报告工具。 (JSP + Servlets)在jasper报告中添加垂直线

我开发了一个名为Cust的报告,其报告名为CustSub。在子报告中,我想要一些列的垂直线,所以我添加了的确切高度的lineBond,Frame和垂直line的高度是相同的。

enter image description here

因此,让我知道是否有这样做的没有更好的办法?

UPDATE1

这是styles我已经申请了备用行颜色

<style name="Detail" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman"/> 
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman"> 
    <conditionalStyle> 
     <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression> 
     <style mode="Opaque" backcolor="#F0EFEF"/> 
    </conditionalStyle> 
</style> 

,这是Detail Band(我已经包括了从代码只有两个文本框,所以请不要考虑x="258"

<detail> 
<band height="18" splitType="Stretch"> 
    <frame> 
     <reportElement uuid="aa7987da-d84a-4d11-b079-44005699151d" style="Row" stretchType="RelativeToBandHeight" mode="Opaque" x="1" y="0" width="555" height="18"/> 

     <textField isStretchWithOverflow="true" pattern="dd/MM/yy" isBlankWhenNull="true"> 
      <reportElement uuid="8a0ce8e2-1beb-4300-81ea-f3422abef623" style="Detail" positionType="Float" x="2" y="0" width="60" height="18"/> 
      <textElement> 
       <font fontName="Times New Roman" size="14"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{TRNDATE}]]></textFieldExpression> 
     </textField> 

     <textField isStretchWithOverflow="true" isBlankWhenNull="true"> 
      <reportElement uuid="74be5885-f344-4451-a3a5-62213d3a3dd1" style="Detail" positionType="Float" x="120" y="0" width="68" height="18"/> 
      <textElement> 
       <font fontName="Times New Roman" size="14"/> 
      </textElement> 
      <textFieldExpression><![CDATA[$F{AMOUNT}]]></textFieldExpression> 
     </textField> 

    <line> 
     <reportElement uuid="06d698e3-34c2-445a-8787-a54bd38a2121" style="Detail" stretchType="RelativeToBandHeight" mode="Transparent" x="258" y="0" width="1" height="18" backcolor="#FFFFFF"/> 
    </line> 

    </frame> 
</band> 
</detail> 
+0

请分享您的代码。 –

+0

@Bhushan你设置了* textFields *(* staticTexts *)的边框吗?您应该发布您的模板 –

+0

@Gopinagh请参阅最新代码 – Bhushan

回答

1

只需拖动行元素,并拖动该元素的底部中间点以增加大小,然后通过拖动左中点来减小宽度。

+0

我完全一样,但它没有给出预期的输出 – Bhushan