Jump to content
Changes to the Jaspersoft community edition download ×

Alternate row background colors?


2005 IR Help

Recommended Posts

By: Daniel Teng - dtdev

Alternate row background colors?

2003-08-12 11:08

Is there a way to alternate the background colors between rows in a detail section?

 

I would like to mimick the look that quicken has to make it easier to view multiple rows with lots of data.

 

Thanks

Daniel

 

 

 

 

By: David Hardwick - dhardwick

RE: Alternate row background colors?

2003-08-12 11:13

Search the forum (left hand side under *Register New Project*) for this question, I've seen it answered a few times in the past.

 

Not sure if you didn't see the search option, I didn't at first either.

 

Rock on,

daveh

 

 

 

 

By: Daniel Teng - dtdev

RE: Alternate row background colors?

2003-08-12 11:35

In my haste, I missed the search box. I know better now :-)

 

Regards

Daniel

 

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: Alternate row background colors?

2003-08-12 11:18

Yes. You have to use a pair of printWhenExpressions and duplicate your detail XML exception for the background color and the printWhenExpression.

 

Example:

 

<textField isBlankWhenNull="true">

<reportElement x="0" y="0" width="80" height="16" forecolor="#000000" backcolor="#E5E5CC" mode="Opaque">

<printWhenExpression>new Boolean($V{REPORT_COUNT}.intValue() % 2 == 1)</printWhenExpression>

</reportElement>

<textElement textAlignment="Center" lineSpacing="Single" verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String">

$F{month}

</textFieldExpression>

</textField>

<textField isBlankWhenNull="true">

<reportElement x="0" y="0" width="80" height="16" forecolor="#000000" backcolor="#CCCC99" mode="Opaque">

<printWhenExpression>new Boolean($V{REPORT_COUNT}.intValue() % 2 != 1)</printWhenExpression>

</reportElement>

<textElement textAlignment="Center" lineSpacing="Single" verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String">

$F{month}

</textFieldExpression>

</textField>

 

 

 

 

 

By: Daniel Teng - dtdev

RE: Alternate row background colors?

2003-08-12 11:33

Thanks guys...

 

 

 

 

By: Terry - terrybrick

RE: Alternate row background colors?

2004-05-21 09:15

Hi,

I'm just starting to research JasperReports and JFreeReports for use in some software. We use alternating row colors in just about every report and will have upwards of 100 different reports. So the solution for this functionality provided here doesn't seem reasonable for my particular needs. So my question is, does the JasperReports architecture make it straight forward enough to make a reusable component for something like this? In other words, can I somehow make a class or extend a class or method that I can just call so I don't have replicate a whole bunch of XML and column names just to alternate row colors for each report?

This is just one example. I guess the 'bigger' question would be, how extensible/customizable is JasperReports for when I have unique requirements.

 

Thanks for your input.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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