I want to write a Windows Forms appl that can dynamically generate a report definition and then view/print the resulting report. What is the best way to programatically generate the equivelent of an .rdlc file that can then be "executed" I see there is documentation on the .rdl format so I suppose I could just generate the file, and then somehow ( ) tell the ReportViewer control to use that file. But I was wondering if there's an object-model way to do it also
I sort-of did this with CrystalRports in VS 2003 - There's no way to dynamically add objects to a report definition, but you can alter the attributes of existing objects. So I made an "empty" report definition that has more than enough of each type of object, then I have code which "uses up" each object as I need, setting it's location, data display, etc. It works but it's cumbersome. I thought maybe the new reporting format might make things easier.
So my questions are:
1) Is there an object model for creating a report definition using the built-in reporting funcionality
2) If I have to generate the .rdl file, how do I then tell the ReportViewer control to use an external file instead of one embedded into the .EXE file
3) Has anyone dynamically (programatically) generated a report definition which they then can display or print using another tool I was thinking about trying it with ComponentOne's reporting object, but haven't dug into the documentation enough to know if it will work better than my CrystalReports approach.
Thanks for any input.
- Bob

Dynamically generating report definition?
Christian Gram
You can use ReportViewer.LocalReport.LoadReportDefinition to load the RDL from a TextReader or Stream, or you can set the LocalReport.ReportPath if you have a file on the file system.
arun_philip
At the moment I am doing exactly the same proof of concept.
Not wanting to re-invent the wheel, could you share any of your findings you feel would be usefull.
Thank-you in advance,
Michelle
smalljoe
This approach looks like it will work fairly well. I'm working on a proof-of-concept test now.
An interesting exercise would be to create an RDL object model that allow the user to define a report using the object model, and then render the appropriate .rdl file when complete. I don't think it would be all that hard to do.
Thanks for your concise and helpful answer.
- Bob