How to fill the PropertiesMap of JRTemplatePrintText in jasperprint from jasperdesign using java

Hello All ,

I have a jasperDesign object where i am looping the elements of the details band and i am filling the properties map of a specific  JRTextField as following

JRTextField textField = (JRTextField) element;
 textField.getPropertiesMap().setProperty("PropName","PropVal");

After compiling the jasperDesign  and getting the JasperPrint object , i looped the elements of the JasperPrint but when i retrieved the value of the previous texfield wich is now a JRTemplatePrintText object ,i found the properties map is null

My question is how can i set a property for a specific element in jasperDesign and get this value from  the jasperPrint ?

Thank you in advance

 

 

NOjeil's picture
120
Joined: Aug 13 2013 - 10:16pm
Last seen: 1 year 4 months ago

2 Answers:

Properties are not automatically transferred to print object, you'll need to configure a property that provides a prefix for properties to be transferred.  E.g. add the following to your jasperreports.properties

net.sf.jasperreports.print.transfer.my.props=my.prefix

and then set my.prefix.* properties to elements.

Regards,

Lucian

lucianc's picture
72638
Joined: Jul 17 2006 - 1:10am
Last seen: 35 min 28 sec ago

Thank you Lucian  , your solution helped me

Regards

 

NOjeil's picture
120
Joined: Aug 13 2013 - 10:16pm
Last seen: 1 year 4 months ago
Feedback
randomness