Skip to main content

XtraReport Class

A DevExpress report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public class XtraReport :
    XtraReportBase,
    ISupportInitialize,
    IServiceProvider,
    IServiceContainer,
    IReport,
    IDocumentSource,
    ILink,
    IComponent,
    IDisposable,
    IExtensionsProvider,
    IParameterSupplier,
    IParameterSupplierBase,
    IRootXmlObject,
    IReportEvents

Remarks

For general information on DevExpress Reporting, refer to the following topic: Get Started with DevExpress Reporting.

Create a Report

You can use the Visual Studio Report Designer to create reports for most common scenarios. You can also create and customize reports in code. See the following documents for more information on both methods:

Display a Prepared Report in Your Application

DevExpress Reporting ships with the Document Viewer and the End-User Report Designer components for the following Microsoft platforms:

  • WinForms
  • WPF
  • ASP.NET Web Forms
  • ASP.NET MVC
  • ASP.NET Core
  • Blazor Server – includes a native viewer and a JavaScript-based viewer and designer.
  • WinUI – includes a viewer only.

Each component includes an API that accepts an XtraReport class instance. You can create an instance of your report in code and use this API to pass your report to the Document Viewer or open it in the End-User Report Designer.

The following example shows how to display a report in the WinForms Document Viewer control:

using DevExpress.XtraReports.UI;
//...

ReportPrintTool printTool = new ReportPrintTool(new XtraReport1());
printTool.ShowRibbonPreview();

The example below demonstrates how to open a report in the ASP.NET Core Document Viewer:

@{
    var viewerRender = Html.DevExpress().WebDocumentViewer("DocumentViewer")
        .Height("1000px")
        .Bind(new XtraReport1());
    @viewerRender.RenderHtml()
}

You can find a list of all available platforms and more information on each of them in the following documentation section: Integrate a Report into the User Interface.

The Report Designer serializes your report while you create it in Visual Studio. This serialization mechanism allows you to create an instance of your report in code. You can then export or print the created report without showing it in the Document Viewer. The latter also applies to reports created in code from scratch.

The following example creates a report instance and exports it to PDF:

using System;
//..

var report = new XtraReport1();
report.ExportToPdf(Environment.GetFolderPath(
    Environment.SpecialFolder.UserProfile) + @"\Downloads\Report1.pdf"
);

Refer to the following document for more information: Print and Export Reports without a Preview.

Implements

See Also