C# – How to dynamically adjust table column width in RDLC report

cdynamic-rdlc-generationnetrdlc

I have a RDLC report in C# which displays a table.

I am providing a facility to the user to select the required columns to be displayed in the report.

So when the number of columns in the report are reduced half of the page on the right side appears blank due to which the presentation of the report looks bad.

I want to find out a way using which either I can set the column size of the visible columns dynamically.

OR

I can change the table location so that the table is displayed in the centre of the page.

So far I have found that I cannot write an Expression or pass parameter to set the size or location of a control in RDLC Report.

I would like to know if there is alternative way of achieving this.

Best Answer

What you could do is to change the rdlc at runtime, it is just and xml file, so you can parse it and go to set the width of the table programmatically. I use this approach to translate my reports for multilanguage and it works fine.

This link shows you how to translate the report, but this code is a good starting point. I think you can easily customize it for your purpose. Change RDLC XML

Related Topic