Lines with alternating colors

Asked

Viewed 990 times

2

I’m putting together a report using Jaspersoft Studio to display a list of system calls. This list has 3 columns, with the number of the call, the title and its creation date.

What I need is that this listing has alternating background color between its lines, that is, first line white background, second light gray, third white and so on.

But I don’t know which resource to use or which rule to create.

1 answer

2

Place a rectangle with the transparent color you want occupying the entire line and add the following rule in the Printwhenexpression event:

$V{report_COUNT}%2 == 1 ou $V{report_COUNT}%2 == 0

I mean, now it prints the rectangle, now it doesn’t.

inserir a descrição da imagem aqui

  • Hi, Reginaldo, thanks for helping me. So, I did as explained and worked, but I have a group header per date, so sometimes a grouping has only one record, or odd number of records, making the first record of the next date ( next grouping ) start with gray background and not white. ?

  • rsrs. I expected the question. You can create a variable, increment it in the Printwhenexpression event, reset it when you change groups and use it instead of using report_count.

  • Unintentionally, you can send me +/- an outline of what this rule would look like ? Because this is the first time I’m using Jasper. Thanks !

  • :( I’m doing it from memory about 5 years ago. I have nothing here now, no IDE, no examples, nothing. This report I sent you I picked up on GMAIL by chance. Sorry. But it’s easy. Follow the logic or leave it at that. No problem starting, sometimes colorful or not.

  • No problem, thanks for the help. I’ll leave the topic open home someone has some idea. Thanks !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.