WPF Multipage Reports Part I

By Jan Repisky at May 25, 2008 10:53
Filed Under: WPF, Reports

When you are building LOB apps, reporting is one of the most important parts.  MS Reporting Services or some other 3rd party reporting solution is usually a choice. What I personally don’t like on MS Reporting services is the definition of styling and related maintenance issues. The fact that it ignores WPF and its capabilities forced me to think about custom implementation of our reporting components.

WPF brings two types of documents, the fixed page document and the flow document. Both are used for different types of reports.

  • Fixed documents are appropriate for predefined forms with absolute positioning. In this case the implementation is pretty straightforward but it is not in the scope of my posts.
  • Flow documents are more suitable for multipage reports (e.g. monthly accounting report).

I will try to describe the implementation of a simplified multipage reporting engine in a series of posts on this blog.

For the illustration suppose you have a report definition as a flow document like this.

reportdefdemo

 

After correct report generation phase you get the multipage wpf report as a result.

OK, let's go to the implementation. The high-level design is defined in the following class diagram (simplified).

ClassDiagram1

The main components are:

  • Report definition
    Defines the basic structure of a report and contains templates for each report part.
  • Data engine
    Gets data from a data source and provides selected calculation tasks, e.g. cumulative sum and grouping.
  • Report Data
    Contains all tha data , that are produced from the data engine and passed further to the report engine
  • Report engine
    The most important part. This part is responsible for the composition of a flow document.
  • Report paginator
    Modifies default flow document paging behavior. Enables custom page header , footer and other page transformations.
  • Document walker
    Traverses any part in the document definition.
  • Print Helper
    Encapsulates print queue and print ticket classes.

In future posts I will go deeper and I will show the inner implementation of selected components.
 

kick it on DotNetKicks.com
Comments are closed

About the author

I have started writing code in 1986 and since 1993 I'm working on application frameworks and solution architecture. I worked for five years for Microsoft Consulting Services. Currently I live in Prague.

I work now as a Solution Architect at Gradual Systems.

Page List