Version

Print All Records in a Hierarchy

The WPF Reporting engine prints/exports a DataPresenter control’s state exactly as-is when you invoke the Print or Export method of the Report object. The resulting printout or exported file is based on how your end users interact with the DataPresenter control before printing or exporting. For example, if you have a hierarchical xamDataGrid™, the WPF Reporting engine will not print child records if your end users do not expand them at run time before printing. However, you can modify this behavior, so that all records are expanded when the WPF Reporting engine prints/exports the DataPresenter control.

Printing all records in a hierarchical data model is a four-step process:

  1. Instantiate a TabularReportView object.

  2. Set the TabularReportView object’s ExcludeExpandedState property to True.

  3. Set the DataPresenter’s ReportView property to your instance of the TabularReportView object.

  4. Create a report using the DataPresenter control and print it.

The following example code demonstrates how to print all records in a hierarchy. The example code sets a xamDataGrid control’s ReportView property; however, you can replace the xamDataGrid control with the xamDataPresenter™ control or the xamDataCarousel™ control.

In Visual Basic:

Imports Infragistics.Windows.DataPresenter
...
Dim reportView1 As New TabularReportView() With { .ExcludeExpandedState = True}
Me.xamDataGrid1.ReportView = reportView1
'TODO: Create a report using the xamDataGrid control and print it.
...

In C#:

using Infragistics.Windows.DataPresenter;
...
TabularReportView reportView1 = new TabularReportView()
{
        ExcludeExpandedState = true
};
this.xamDataGrid1.ReportView = reportView1;
//TODO: Create a report using the xamDataGrid control and print it.
...