Reporting in .NET Part II
Sat, Dec 18 2010 22:40
This prior post covers the steps for building and displaying a report in .NET. But how often do you need just one report? Normally, you need to build several if not many reports. That brings up several issues:
- How do you set a style that you can reuse for every report?
- It would be nice to set fonts, styles, colors, and so on to ensure that the reports all look similar.
- How do you set up reusable text for the report?
- For example, a standard header or standard end of report text.
- How do you ensure that the reports are the same standard size?
- You may want two standard sizes: one for portrait and one for landscape.
Seems like a reasonable set of questions. The disappointing part is that there are no great answers when using Visual Studio's reporting services.
Here are some options:
- Build a template.
- Use expressions.
- Update the XML at design time.
- Update the XML at run time.
There is no style sheet for a report like in ASP.NET, WPF, or Silverlight. There is no ability to write code to work with the controls on the report beyond the capabilities of expressions. None of the above options is perfect, but they each provide some features to help you reuse parts of your reports.