SQL Server Report Builder: Whitespace left after *correctly* hiding columns

envsm3lx  于 2023-08-02  发布在  其他
关注(0)|答案(2)|浏览(90)

I have created a report which has the possibility of three different sets of columns depending on the selected detail level.

I have set a visibility expression on the column itself (right click on column header) which is functioning correctly. This is distinct from setting the hidden property on the individual cells.

Most people asking about this issue are only setting hidden=true on the individual cells. This results in the cells going invisible BUT the space they take remains, leaving a big gap in the middle of the set of columns.

As noted above, I'm setting the whole column to visible=false. This correctly collapses the whitespace, HOWEVER the width of the report body is not recalculated. This means a large amount of white space is displayed to the right of my columns. The major problem caused by this is that it forces the user to scroll over a long way to press the view report button. This occurs in report builder itself, and whilst using the report viewer control. Printing and exporting work OK (after much fiddling with margins/etc).

The only workaround I have heard for related issues is to create three different tablixes containing the different column sets. (I heard about this solution in relation to people working around the problem of setting hidden=true without realizing they needed to set visible=false.) This isn't going to help as the body of the report still must be equal to the width of the widest tablix. That will cut down my extra whitespace a little, but the problem still remains and is definitely noticeable.

There is an option ConsumeContainerWhitespace property that exists on the report itself that comes up in some searches. This appears to be related to a different problem and has no impact on what I'm talking about here.

vjhs03f7

vjhs03f71#

Instead of creating three different tablixes, create three different reports and then use them as a subreport on your main report, showing a different version depending on the parameters. This should make the blank space go away.

Not an ideal solution, but I don't know another way of doing it.

g52tjvyc

g52tjvyc2#

Have the same problem, here what works for me:

Instead of changing properties via textbox, click at your table to appear gray boxes for each column and row. Choose those which suits your column (or row), change each visibility separately, by going to its propierties via right click on gray box and choosing 'Column visibility...'.

Then change it the way you want, hide or put your expression.

相关问题