Jump to content

set band and other attributes dynamically


nirvanb

Recommended Posts

 Hi,

     I am trying to print cheque using jasper reports. The problem is that the areas (starting location, width, top, of say Date line)  where I want to print the data varies to some extent. So I tried to set them using parameters, but it seems jasper reports does not support setting these attributes using parameters. Here is what I tried to do.

    <detail>

        <band height="$P{ChequeHeight}">

            <textField>

                <reportElement x="$P{DateLeft}" y="$P{DateHeight}" 

                                    width="$P{DateWidth}" height="30"/>

.....
 
I get the following error when I try to validate jrxml.
 
jasperreports.engine.JRException: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '$P{ChequeHeight}' is not a valid value for 'NMTOKEN'.
cvc-datatype-valid.1.2.1: '$P{DateLeft}' is not a valid value for 'NMTOKEN'. [41] 
cvc-attribute.3: The value '$P{DateLeft}' of attribute 'x' on element 'reportElement' is not valid with respect to its type, 'NMTOKEN'. [41]
 
and same for DateHeight, and DateWidth.
 
Any ideas for how to set the attributes dynamically. Also the height of the band needs to be set dynamically.
 
regards,
Nirvan
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I believe we can't use parameters for setting the attributes. But there is the JasperDesign api which allows to modify the attribute settings dynamically at runtime. So I will close this question.

regards,

Nirvan.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...