views:

160

answers:

1

I am using jasper report to create pdf document. I used one Subreport inside 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 datasourece returns null value. Can anyone guide me how to solve this problem.

Below you can see the xml code which i used for 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> </line>.

A: 

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.

medopal