【发布时间】:2012-03-01 06:38:37
【问题描述】:
我必须为报告检索到的行实现备用背景颜色,但问题是它具有聚合/求和功能并且无法正常工作,因此我使用了下面的代码 -
Private bOddRow As Boolean
'************************************************* ************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'************************************************* ************************
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
'
Function RestartColor(ByVal OddColor As String) As String
bOddRow = True
Return OddColor
End Function
所以我现在有三种不同的单元格背景:
- 数据行第一列有 =Code.AlternateColor("AliceBlue", "White", True) (这与上一个答案相同。)
- 数据行的其余列有 =Code.AlternateColor("AliceBlue", "White", False) (这也与上一个答案相同。)
我不明白的是,为什么将第一列设为真而将其余列设为假?任何帮助将非常感激。
上面的代码无论有没有下面的功能都相同(我还是不明白)
'
Function RestartColor(ByVal OddColor As String) As String
bOddRow = True
Return OddColor
End Function
我从另一个论坛获得此代码,我是 SSRS 和 VB 的新手。请帮忙。
提前致谢
【问题讨论】:
标签: ssrs-2008 reporting-services reportingservices-2005 ssrs-tablix