August 19, 2011 at 4:48 am
Hi,
In my Matrix report I want the alternate rows to be colored in different colors for easy readability.
I tried the following code in the background color but it did not work properly. I get two different colors but, it is not for alternate rows. It is haphazard. In my matrix table many fields are blank. Is this the cause ?
=iif(RowNumber(Nothing) Mod 2, "silver", "White")
How can I do this?
I have this issue only for matrix reports. Otherwise it works fine.
Regards,
Nithin
August 22, 2011 at 8:06 am
Instead of Nothing, put the name of the whole data region. That will fix it for you if you have one group and details. If you have more than one group, well, VB code by WROX might help (it did not for my case).
August 22, 2011 at 8:52 am
I did try using my dataset as shown below
=iif(RowNumber(GroupName) Mod 2, "silver", "White")
It also gave me the same result as shown in the below link:
November 17, 2011 at 2:14 pm
When using Mod 2 - it get same result.
Perhaps there is a better method, search via google.com , if you find it please notify us via this forum page.
November 17, 2011 at 2:27 pm
Add code to the Report:
Private bOddRow As Boolean
Function AlternateColor(ByVal OddColor As String, _
ByVal EvenColor As String, ByVal Toggle As Boolean) As String
If Toggle Then bOddRow = Not bOddRow
If bOddRow Then
Return OddColor
Else
Return EvenColor
End If
End Function
For the BackgroundColor property of the first textbox (in the left-most column of the row,) enter the following expression to call the custom code function (substitute your colors):
=Code.AlternateColor("AliceBlue", "White", True)
Define an extra Column group on the same field expression as the previous group.
=Code.AlternateColor("AliceBlue", "White", False)
Hide the cell, try to hide the column as best as possible. It won't go away completely, but you can set the width to almost nothing.
Then on each remaning cell in the row, set the BackgroundColor as follows:
=Code.AlternateColor("AliceBlue", "White", False)
need to change "True" to "False" for all columns in the row after the first, otherwise you will see a checkerboard effect
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply