Jump to content
We've recently updated our Privacy Statement, available here ×

Is it possible to set the HTML class attribute?


phantastes
Go to solution Solved by mdahlman,

Recommended Posts

  • 2 months later...
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

  • 2 weeks later...

 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"/>

 

...

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...