skulaz Posted March 20, 2009 Share Posted March 20, 2009 Hi Guys,I'm trying to force the size of a single text element of my jasper print using the Custom Element Property "net.sf.jasperreports.default.font.size"But the result never changes.I've seen, debugging the source code that in the class JRProperties there is this method called by JRBaseFiller at line 400:.............. public static List getProperties(JRPropertiesMap propertiesMap, String prefix) { int prefixLength = prefix.length(); List values = new ArrayList(); if (propertiesMap != null) { String[] propertyNames = propertiesMap.getPropertyNames(); for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames; if (name.startsWith(prefix)) { String suffix = name.substring(prefixLength); String value = propertiesMap.getProperty(name); values.add(new PropertySuffix(name, suffix, value)); } } } return values; }.........debugging the code line in red i see that it expects in the name of my custom propertya string like this net.sf.jasperreports.export. So I added this string in the name of my attribute changing the attribute name in "net.sf.jasperreports.export.net.sf.jasperreports.default.font.size" and i successfully entered that if construct, but the output result remains the same: the font for the elements is the default (10px).Do you have any suggestion about this problem?I'm using jasper 3.0.0Thanks in advance.Bye Link to comment Share on other sites More sharing options...
lucianc Posted March 23, 2009 Share Posted March 23, 2009 skulazWrote: I'm trying to force the size of a single text element of my jasper print using the Custom Element Property "net.sf.jasperreports.default.font.size" This property can only be set globally (per system), as stated in the configuration reference, and will not have any effect when set at report element level.You should use the fontSize text attribute instead.Regards,Lucian Link to comment Share on other sites More sharing options...
skulaz Posted March 24, 2009 Author Share Posted March 24, 2009 Thank you for your reply, but i need to determine the font size at runtime, when filling the report, using an expression. Any suggestion? Link to comment Share on other sites More sharing options...
lucianc Posted March 25, 2009 Share Posted March 25, 2009 As far as I know, that's not truly possible.The only feature that's close to this is conditional styles, but that would only allow you to switch between a static (defined at design time) list of font sizes.Regards,Lucian Link to comment Share on other sites More sharing options...
skulaz Posted March 26, 2009 Author Share Posted March 26, 2009 Thank you Lucian for your reply.It means that i could not set different font size for each row of my report at runtime?RegardsNicola Link to comment Share on other sites More sharing options...
lucianc Posted March 26, 2009 Share Posted March 26, 2009 You can set different font sizes for different rows, but the font size cannont be fully dynamic. What you can do is to define a style that contains conditional styles with different font sizes (see below).What you cannot do is to use an expression as font size.Regards,LucianCode:<style> <conditionalStyle> <conditionExpression>$F{field}.equals("big")</conditionExpression> <style fontSize="20"/> </conditionalStyle> <conditionalStyle> <conditionExpression>$F{field}.equals("medium")</conditionExpression> <style fontSize="14"/> </conditionalStyle> <conditionalStyle> <conditionExpression>$F{field}.equals("small")</conditionExpression> <style fontSize="20"/> </conditionalStyle></style> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now