Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I adjust overall width of rdlc report when some columns are hidden?

I have a customizable rdlc report where the user can choose which columns to show. All the columns are included in the report designer, and I use parameters to hide/show columns based on the user's choice. The report renders correctly, and only shows the selected columns, HOWEVER, the overall width of the report is the same as if all the columns were visible. This means that the report can have a huge empty area to the right of the selected columns, which looks very silly.

So my question: Is there a way to adjust the report width dynamically at runtime to avoid a large silly empty area in the report? I attempted to do this in the designer by assigning a parameter to the width of the report body....but that was not allowed. The width cannot be an expression of any kind in the designer, only an actual value is allowed.

Any suggestions?

like image 437
user115487 Avatar asked Mar 08 '10 22:03

user115487


People also ask

How do I change the width of a column in report builder?

Hover over the column handle edge that you want to expand. A double-headed arrow appears. Click to grab the edge of the column and move it left or right to adjust the column width.


2 Answers

I have a workaround that might be silly, but at least it works for me; so after you're finished with the rdlc report designer, close it and then open the rdlc report with the xml editor, then within the <Report> tag right after the <body>...</body> tag you can see a <width>...</width> tag that contains the width of the report, modify its value to a really small value ( lets say <width>1in</width>), this should make the report show without the silly spaces.

But remember that if you open the rdlc report in the designer, it will reset the width to the view area so the problem will appear again, so do it after you are done from the report.

I know its a silly solution, but its better silly at the developer side than at the customer side ^_^.

Hope this helps.

like image 130
Max Avatar answered Sep 28 '22 01:09

Max


If it possible you can increase width of another column to fill empty space. I solved this problem as follows.

For example I have columns 'Name' and 'Discount'. Discount can be hidden and I should change Name.Width to Name.Width+Discount.Width.

I've made a new column (call it 'NameExt') right from 'Name' column with the same width as Discount.Width. Merged cells of 'Name' column and 'NameExt' column. Then set visibility rule for 'Discount' and inverse visibility rule for 'NameExt'.

Hope this can help.

like image 26
Ilya Khorin Avatar answered Sep 28 '22 02:09

Ilya Khorin