Is it possible to set the HTML class attribute?

Hi,

It is possible to set the html id using net.sf.jasperreports.export.html.id. 

Is there any way to set the html class attribute in a similar way?

Magnus

phantastes's picture
2779
Joined: Aug 22 2008 - 2:05pm
Last seen: 10 years 4 months ago

 did you find any solution to it ? was actually looking for something like that ( set class element in HTML exported element ) 

mferretti - 12 years 7 months ago

Have you tried the JR forum yet? This probably needs to be broken into two pieces:

  1. Can JR do this?
  2. How can you set it in iReport?

Point one should be on the JR forum. Point two would be here. (I don't know if it's possible. It sounds entirely reasonable, but I haven't heard of it being done before.)

Regards,
Matt

mdahlman - 12 years 7 months ago

Hi,

1. As far as I know there is no such property yet. This list contains the id property but not a class property:

http://jasperreports.sourceforge.net/config.reference.html

2. I guess there is some kind of workaround by assigning the first part of the ID as static string: "useThisAsAClass"+$F{uniqueID}

And then use the static string part as a class. This is far from optimal though and it would certainly be nice with a class property.

 

Magnus



Post Edited by phantastes at 02/22/2011 19:23

phantastes - 10 years 8 months ago

1 Answer:

Magnus,

I haven't been on the JR forum to know if you discussed this topic there. But I just got the JR 4.0.1 release notification. It adds:

"custom property "net.sf.jasperreports.export.html.class" added at element level to allow 
specifying the CSS "class" attribute for elements when exported to HTML and XHTML/CSS format;"

As far as I can tell, this is precisely what you're looking for.

Regards,
Matt

mdahlman's picture
37526
Joined: Mar 13 2007 - 2:43am
Last seen: 8 years 10 months ago

Thanks Matt!

You guys are really good at listening to feedback! Impressive.

 

Magnus

phantastes - 12 years 7 months ago

 just tested . 

you guys rock !

mferretti - 12 years 7 months ago

Hello,

Do we have any samples for this or some more documentation ?

 

 

Regards,

Bansi

bansi - 12 years 6 months ago
show 1 more...

 Hi,

in practice, what you have to do is add  <property name="net.sf.jasperreports.export.html.class" value="YOURVALUE"/>  to the report element that you want, in HTML, to be of class="YOURVALUE". 

 

Eg. 

<reportElement x="157" y="0" width="15" height="78">

<property name="net.sf.jasperreports.export.html.class" value="verticaltext"/>

 

...

mferretti - 12 years 6 months ago
Feedback