我在 SQL Server 2008 R2 上使用 SSRS,我有具有动态背景颜色的单元格,当背景为白色时如何将字体更改为黑色。
我努力了:
=iif (Fields!DATE.BackgroundColor = "White" , "Black", "White")
我在 SQL Server 2008 R2 上使用 SSRS,我有具有动态背景颜色的单元格,当背景为白色时如何将字体更改为黑色。
我努力了:
=iif (Fields!DATE.BackgroundColor = "White" , "Black", "White")
You'll need to set the two properties in two expression based on the same condition. Even if the Textbox is displaying a different field in its text, you can still use any fields in the same row in the property expression.
e.g. for BackgroundColor use something like:
=IIf(Fields!Date.Value < CDate("01-Jan-2013"), "Black", "White")
then for the Color property use something like:
=IIf(Fields!Date.Value < CDate("01-Jan-2013"), "White", "Black")
Here for dates prior to 01-Jan-2013
, the Textbox will be black with white text, and for dates from this year, the Textbox will be white with black text.
Edit after comments
Just to confirm, there is no readily available way to check report items properties (other than Value
) in SSRS expressions. I agree this would be nice but for now this is not an option.
So you need to use the same condition check for both the BackgroundColor and Color property expressions.
It sounds like you already have something set for BackgroundColor so it should be straightforward to apply an updated expression for Color where required.