What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer?
I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.
What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer?
I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.
Lisa Nicholls gives a complete answer in this thread about dynamically defining a report. You'll want to scroll down some before you get to a useful answer. This thread most directly answers your question about controlling which columns are displayed.
These same techniques can be used to size the columns programmatically, but your code will have to figure out the appropriate column widths.
Dan Smith also has a good solution at: http://csharpshooter.blogspot.com/2007/08/revised-dynamic-rdlc-generation.html
Majid also has a refinement of Dan's solution in the comments to that blog entry that doesn't need to write any files to the file system.