Odd and even style for databand rows

Stimulsoft Reports.JS discussion
Post Reply
anli
Posts: 13
Joined: Wed May 03, 2017 12:49 pm

Odd and even style for databand rows

Post by anli »

Hello,

I want to print the background of a databand with different colors for odd and even rows. How can I achieve this alternate colors? I tried with Appearance - Odd style and Even style properties on the databand but didn't find out which expression to use (maybe e.Row % 2 == 0?) and how to set a solid brush of e. g. red and green.

How can I achieve this?

Thanks a lot for your help in advance!
Best regards, André
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Odd and even style for databand rows

Post by Lech Kulikowski »

Hello,

You can use Conditions with the following expression:
(Line % 2 == 0)

Thank you.
anli
Posts: 13
Joined: Wed May 03, 2017 12:49 pm

Re: Odd and even style for databand rows

Post by anli »

Hello Lech,

thank you for your answer. How can I set the brush and the color?
Best regards, André
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Odd and even style for databand rows

Post by Lech Kulikowski »

Hello,

You can add Styles and apply the necessary style in the Conditions, or set the brush and the color in the Conditions.

Thank you.
anli
Posts: 13
Joined: Wed May 03, 2017 12:49 pm

Re: Odd and even style for databand rows

Post by anli »

Hello Lech,

thanks a lot for your answer. Can you please provide an example code or link to documentation to show me how I can set the brush and the color in the conditions?

Thanks in advance!
Best regards, André
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: Odd and even style for databand rows

Post by Max Shamanov »

Hello,

Please check the attached report.

Thank you.
Attachments
ReportCondition.mrt
(206.31 KiB) Downloaded 272 times
anli
Posts: 13
Joined: Wed May 03, 2017 12:49 pm

Re: Odd and even style for databand rows

Post by anli »

Hello,

thank you! I needed a moment to find it but not it works well :-) Thanks a lot!
Best regards, André
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: Odd and even style for databand rows

Post by Max Shamanov »

Hello,

You are welcome!
eh13
Posts: 9
Joined: Wed Sep 15, 2021 2:06 am

Re: Odd and even style for databand rows

Post by eh13 »

Since databands have an oddstyle, why can't it reset with new groups so it doesn't require conditions?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Odd and even style for databand rows

Post by HighAley »

Hello,

This is a behavior of our tool by design.
There can be cases when this is important, for instance, when the group header is invisible.

Thank you.
Post Reply