I am using jasper report to create pdf document. I used one Subreport inside the main document. This Subreport consist of 3 textfield and one line. I use javabean datasource to populate the value. Now I could not see line if the datasource returns null value. Can anyone guide me how to solve this problem.
Below you can see the xml code which I used for drawing line in jrxml file:
<line direction="TopDown">
<reportElement mode="Transparent" x="-6" y="17" width="480" height="0"
forecolor="#C6C8CA" key="line-1" isPrintInFirstWholeBand="true"/>
<graphicElement stretchType="NoStretch">
<pen lineWidth="0.25" lineStyle="Solid"/>
</graphicElement>
&l开发者_如何学运维t;/line>
Is the line in the same Band
with the text fields? If yes, then that's you problem. In Jasper if the datasource returns no elements. The band will not be rendered, as simple as that.
If you want the line to always appear put it in a band that is always rendered by default. Like Page_Header
, Page_Footer
...etc.
This also happens when 2 items overlap. If your text box is over the line, change line's order by Order->Bring to Front
精彩评论