Cross-Platform Reporting
- 3 minutes to read
This document describes the functionality available for console or web server applications that do not provide any GUI and which you can use without referencing any platform-specific libraries.
Direct Printing
You can use the PrintToolBase.Print method to implement printing in a console or web server application that does not provide any GUI, for example:
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using System.Drawing.Printing;
// ...
static void Main(string[] args) {
var settings = new PrinterSettings();
var printer = settings.PrinterName;
var report = new XtraReport1();
report.PrinterName = printer;
report.CreateDocument();
PrintToolBase tool = new PrintToolBase(report.PrintingSystem);
tool.Print();
}
Tip
The PrintToolBase class does not reference any WinForms or other platform-specific components.
Direct Export
You can use the XtraReport class methods to implement exporting in a console or web server application that does not provide any GUI, for example:
using DevExpress.XtraReports.UI;
using System.Web.Mvc;
using System.IO;
// ...
public ActionResult ExportPdf() {
XtraReport report = new Reports.SampleReport();
MemoryStream ms = new MemoryStream();
report.ExportToPdf(ms);
return File(ms.ToArray(), "application/pdf");
}
Tip
You do not need to reference any WinForms or other platform-specific components to use these methods in your application.
Libraries Required for Report Printing and Exporting
The following libraries are required to print or export a report.
Required Assembly | Description |
---|---|
DevExpress.Data.v18.1.dll | Implements the most basic functionality common to all DevExpress controls. |
DevExpress.Printing.v18.1.Core.dll | Contains classes that implement the basic functionality for DevExpress printing libraries. |
DevExpress.XtraReports.v18.1.dll | Contains the XtraReport class. |
Optional Assembly | Description |
DevExpress.Charts.v18.1.Core.dll | Required only if a report contains at least one XRChart control. |
DevExpress.DataAccess.v18.1.dll | Required only if a report is bound to an SQL or Entity Framework data source. |
DevExpress.Office.v18.1.Core.dll | Required for report export to DOCX, or when a report contains at least one XRRichText control. |
DevExpress.Pdf.v18.1.Core.dll | Required only for report export to PDF. |
DevExpress.PivotGrid.v18.1.Core.dll | Required only if a report contains at least one XRPivotGrid control. |
DevExpress.RichEdit.v18.1.Core.dll | Required for report export to DOCX, or when a report contains at least one XRRichText control. |
DevExpress.RichEdit.v18.1.Export.dll | Required for report export to DOCX. |
DevExpress.Sparkline.v18.1.Core.dll | Required only if a report contains at least one XRSparkline control. |
DevExpress.Xpo.v18.1.dll | Required only if a report is bound to an SQL or Entity Framework data source. |
DevExpress.XtraCharts.v18.1.dll | Required only if a report contains at least one XRChart control. |