Report Design: Shrinking Hidden Static Table Columns
Reporting Services 2008 introduced the ability to dynamically hide table columns and shrink the width of the table (and the report body) at the same time automatically. That said, you also have the ability to just hide the contents, but not the actual table column and preserve the space.
I see this question come up occasionally that users get one behavior, but want the other behavior. This posting explains the differences in the report design. The posting attachment contains the final report (download) to demonstrate shrinking when hiding table columns.
First I want to show what happens if you simply select a table column on the design surface, and set the Visibility.Hidden property based on a Boolean report parameter value:
In this case you simply hide the contents inside the table column, not the actual table column itself. As a result, the report rendering will preserve the space consumed by the column:
Now, let’s instead hide the actual table column to shrink both the table width, as well as the report body as much as possible if the user selects to hide the middle name at runtime:
- On the report design surface, click on the small triangle and select "Advanced Mode" to show static members, as shown in the screenshot.
- In order to dynamically shrink the second table column, select the second static column in the grouping pane.
- The property grid should now show the properties for the static tablix member. Set the Visibility.Hidden expression based on the Boolean report parameter value:
As a result, the report rendering will now shrink the entire table width, as well as the report body (denoted by the black border line). In our example, the customer names heading textbox is then the widest report item and determines the final report body width at runtime: