1

I am using Microsoft Report Viewer v11.0.0.0. I have a table with 10 columns in my report page. The last column of the report might be hidden depending on a parameter. What I want is to automatically re-size of a column whose title is Description depending on this parameter (or the visibility of the last column) as well. So lets say if parameter p is 1, then column description would be 5 cm, otherwise it would be 8 cm. I did not see an area for a column to write an IIF expression for its size so got stuck. I would really appreciate if anyone helps.

Edit: I saw this page, but it did not work for me: http://blog.sharepointalist.com/2009/05/ssrs-column-width-auto-size.html

Eray Balkanli
  • 7,752
  • 11
  • 48
  • 82

1 Answers1

2

One trick to accomplish this is to create an extra column that is 8cm wide and contains the same data as the 5cm column.

You have columns A and B.

  • A is 5cm
  • B is 3cm
  • C contains the same data as A but is 8cm

Now select column A and set the column visibility (right-click the column header to edit this). Set 'show or hide based on expression' to =IIF(Parameters!Paramter_p.Value = 1, True, False)

Do the same for B.

Do almost the same for C, but set the 'show or hide based on expression' to =IIF(Parameters!Paramter_p.Value = 1, False, True)

Now when Parameter_p = 1 Column A and B will be visible and take up 8cm. When Parameter_p <> 1 Column A and B will not be visible and will be replaced by the 8cm Column C.

This effectively looks like Column A expanded from 5cm to 8cm to take up the extra 3cm space from the hidden Column B.

Jesse Potter
  • 827
  • 5
  • 20