[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Collapse]Use Report Controls
    Add Controls to a Report
    Manipulate Report Controls
    Use Basic Report Controls
   [Expand]Use Tables
   [Expand]Use Bar Codes
   [Expand]Use Charts and Pivot Grids
   [Expand]Use Gauges and Sparklines
   [Expand]Drawing Lines and Shapes
   [Collapse]Using Custom and Third-Party Controls
     Use Third-Party Controls
     Create Custom Controls
     Create a Custom Numeric Label
     Create a Custom Progress Bar Control
  [Expand]Shape Report Data
   Arrange Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Expand]Provide Interactivity
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Use Third-Party Controls

This document describes how to add third-party visual elements to a report. Apart from standard controls, a report can contain controls from the System.Windows.Forms namespace, Printing Links or custom user-defined objects.

Expanded Embed Third-Party WinForms Controls

You can add a Windows Forms control to a report at Visual Studio design time by copying and pasting this control from its System.Windows.Forms.Form designer. A WinControlContainer hosts this control after adding it to the report.

A report can contain any Windows Forms visual control that supports the .NET drawing engine (based on the System.Drawing.Graphics class that provides support for GDI+). XtraReports cannot host Win32 or ActiveX components for this reason.

Use the WinControlContainer.DrawMethod property to specify the rendering mode of a Windows Forms control.

Handle the XRControl.Draw event of a corresponding WinControlContainer to provide a custom logic during the rendering of a control.

You can print standard Windows Forms controls using the following appropriate Printing Links:

  • ListViewLink - a link to print the System.Windows.Forms.ListView control.
  • RichTextBoxLink - a link to print the System.Windows.Forms.RichTextBox control.
  • TreeViewLink - a link to print the System.Windows.Forms.TreeView control.
  • DataGridLink - a link to print the System.Windows.Forms.DataGrid control.

Expanded Embed DevExpress WinForms Controls

You can add a DevExpress WinForms control to a report using a PrintableComponentContainer. It enables printing documents created using Printing Links as well as objects that implement the IPrintable interface. The following DevExpress controls implement this interface.

Do the following to embed such a control to a report:

  1. Prepare a WinForms application containing the controls you want to print (for instance, the GridControl in this example).

  2. Add a new empty report to your WinForms application.
  3. Open the Visual Studio Toolbox (by pressing CTRL+ALT+X) and expand its DX.19.1: Report Controls tab. Drag the PrintableComponentContainer control from this tab and drop it onto the report's detail band.

  4. Change the added container's modifier to public to be able to assign the required properties outside of the XtraReport class descendant scope.
  5. Specify the PrintableComponentContainer.PrintableComponent property to associate the Windows Forms controls with the corresponding report containers. Use the methods of the ReportPrintTool class to invoke the default Print Preview form and show a report document in it.

The following image illustrates the resulting report document containing a WinForms control.

Expanded Embed DevExpress ASP.NET Controls

You can embed the following DevExpress web controls into a report using the corresponding exporter objects:

ASP.NET WebForms Control Exporter
ASPxGridView ASPxGridViewExporter
ASPxCardView ASPxCardViewExporter
ASPxVerticalGrid ASPxVerticalGridExporter
ASPxPivotGrid ASPxPivotGridExporter
ASPxTreeList ASPxTreeListExporter
ASP.NET MVC Control Exporter
MVCxGridView MVCxGridViewExporter
MVCxPivotGrid MVCxPivotGridExporter
MVCxTreeList MVCxTreeListExporter
MVCxCardView MVCxCardViewExporter
MVCxVerticalGrid MVCxVerticalGridExporter

Assign an exporter object to the PrintableComponentContainer.PrintableComponent property in code to embed the corresponding control into a report.

An online example is available at How to print DevExpress ASP.NET controls via XtraReports.

Expanded See Also

Is this topic helpful?​​​​​​​