如何对SQL Server Reporting Services报表中的交替行添加底纹?
编辑:下面列出了一堆不错的答案--从quick、simple到complex and comprehensive。我只能选择一个..。
发布于 2008-09-04 18:19:33
转到表行的BackgroundColor属性,然后选择"Expression...“
使用此表达式:
= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")
这个技巧可以应用于报告的许多领域。
在.NET 3.5+中,您可以使用:
= If(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")
不是在找推荐人--我只是自己研究了这个问题,想和大家分享一下。
发布于 2008-09-17 14:29:35
使用IIF(RowNumber...)在对行进行分组时可能会导致一些问题,另一种替代方法是使用简单的VBScript函数来确定颜色。
这需要更多的努力,但当基本解决方案不能满足需要时,它是一个很好的替代方案。
基本上,您可以将代码添加到报告中,如下所示...
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
然后,在每个单元格上,按如下方式设置BackgroundColor:
=Code.AlternateColor("AliceBlue", "White", True)
有关详细信息,请参阅此Wrox article
发布于 2011-07-21 22:47:17
当我使用Catch22的解决方案时,我得到了国际象棋效果,我想是因为我的矩阵在设计中有多个列。这句话对我来说很管用:
=iif(RunningValue(Fields![rowgroupfield].Value.ToString,CountDistinct,Nothing) Mod 2,"Gainsboro", "White")
https://stackoverflow.com/questions/44376
复制相似问题