Version

Exclude DataPresenter Settings When Printing

The WPF Reporting engine prints/exports the 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 your end user sorts a field, the WPF Reporting engine will print the records using their current sort order. However, you can exclude certain DataPresenter control settings when you print or export a report.

The DataPresenter controls expose a ReportView property that you can set to an instance of the TabularReportView class. The TabularReportView class exposes Boolean properties that start with the word "Exclude" that you can set in order to exclude certain DataPresenter settings from being printed.

Excluding a DataPresenter control’s settings when printing a report is a four-step process:

  1. Instantiate a TabularReportView object.

  2. Set the TabularReportView object’s properties that exclude DataPresenter settings off the TabularReportView object.

  3. Set the DataPresenter control’s ReportView property to the TabularReportView object.

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

The following example code demonstrates how to exclude a xamDataGrid™ control’s sort order when printing a report. Even though the example code uses a xamDataGrid control, you can use any of the DataPresenter controls in its place.

In Visual Basic:

Imports Infragistics.Windows.DataPresenter
...
Dim reportView1 As New TabularReportView() With { .ExcludeSortOrder=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()
{
        ExcludeSortOrder = true
};
this.xamDataGrid1.ReportView = reportView1;
//TODO: Create a report using the xamDataGrid control and print it.
...