开发者

Row color and Alternate Row color for Table in RDLC Report

How do 开发者_运维百科I give row color and alternate row color for a Table in RDLC report? When I googled I found most of the result says something like = iif(RowNumber(Nothing) mod 2, "Red", "White") OK! But where should I place this stuff? Any help will be appreciated.


Very easy! :-)

In your report designer surface, you need to select the data row that contains your data - something like this:

Row color and Alternate Row color for Table in RDLC Report

When you look at the Properties box for that data row, you will see a property call BackgroundColor - open the dropdown, and you'll see all the usual colors - but also a menu item at the bottom called Expression...:

Row color and Alternate Row color for Table in RDLC Report

When you select that item, a dialog box will open that allows you to insert an expression to determine the background color for that row - that's where you need to put that expression that you have - and that's all there is!


If you don't want to add a RowNumber field to your dataset, just use the built in function RowNumber(ScopeName as String). I commonly use the name of the DataSet as parameter:

= IIF(RowNumber("CarsWithNoMakeDataSet") Mod 2 = 0, "LightGrey", "Transparent")

You can find this function at the Expression dialog, Category "Common Functions", Subcategory "Miscellaneous"

As the ScopeName parameter it is possible to use the name of a Group or Data Region. Please find more here.

Hope it helps,


The expression definition to alternate the row color is:

=iif(Fields!RowNumber.Value Mod 2 = 0,"LightGrey","White")

This sample assumes you have a field RowNumber in your dataset.


You can use group data region instead of dataset name.

Eg: = IIF(RowNumber("MonthOfYearId") Mod 2 = 0, "LightSteelBlue", "No Color")


Note that using dynamic expression can affect the time required to export a report. For a report with 5K of rows, the time increase may reach 2-3 minutes.

This is the expression I had to remove from one of my reports to make the export time acceptable: =iif(RowNumber(Nothing) Mod 2, "White", "#e6eefc")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜