New to Telerik ReportingStart a free 30-day trial

Represents the object responsible for printing and rendering Reports.

Definition

Namespace:Telerik.Reporting.Processing

Assembly:Telerik.Reporting.dll

Syntax:

C#
public sealed class ReportProcessor

Inheritance: objectReportProcessor

Constructors

Initializes a new instance of the ReportProcessor class.

C#
public ReportProcessor()

Properties

PrintController

PrintController

Specifies a print controller to be used when printing a Report. If a null value is specified, a default print controller is used, which displays the Print Progress dialog.

C#
public PrintController PrintController { get; set; }

If you need a better control over the printing process, or simply to customize the appearance of the print UI, you should specify a custom print controller to this method.

This example shows how to customize the title of the Print Progress dialog with a custom provided print controller.
cs
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings =
    new System.Drawing.Printing.PrinterSettings();

// Create a custom print controller based on the StandardPrintController with title: Print Progress
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

System.Drawing.Printing.PrintController customPrintController =
    new System.Windows.Forms.PrintControllerWithStatusDialog(standardPrintController, "Print Progress");

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
    new Telerik.Reporting.Processing.ReportProcessor();


reportProcessor.PrintController = customPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

reportProcessor.PrintReport(typeReportSource, printerSettings);
vb
Dim reportName = "ReportCatalog, VB.ReportLibrary"

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' Create a custom print controller based on the StandardPrintController with title: Print Progress 
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController Dim customPrintController As New System.Windows.Forms.PrintControllerWithStatusDialog(standardPrintController, "Print Progress")

' Create a report source to pass the report to the report processor
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor reportProcessor.PrintController = customPrintController reportProcessor.PrintReport(typeReportSource, printerSettings) 

Methods

Gets a read-only collection of available rendering extension names.

C#
public static IReadOnlyList<string> GetAvailableRenderingExtensions()
Returns:

IReadOnlyList<string>

A read-only collection of strings representing the names of the available rendering extensions (e.g., "PDF", "XLSX", "DOCX").

Prints a report document using the specified printer settings.

C#
[Obsolete("The static (Shared) ReportProcessor.Print method is now obsolete. Please create an instance of the ReportProcessor class and use the PrintReport method.")]
public static void Print(IReportDocument reportDocument, PrinterSettings printerSettings)
Parameters:reportDocumentIReportDocument

Specifies an instance of a report document to print. Both Report and ReportBook documents are supported.

printerSettingsPrinterSettings

Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
csharp
// Create an instance of the report to print.
IReportDocument reportDocument = new MyReport();
// Obtain the settings of the default printer.
PrinterSettings printerSettings = new PrinterSettings();
// Adjust the printer settings if necessary...

// Print the report using the printer settings.
ReportProcessor.Print(reportDocument, printerSettings);
csharp
' Create an instance of the report to print.
Dim reportDocument As IReportDocument = New MyReport()
' Obtain the settings of the default printer.
Dim printerSettings As New PrinterSettings()
' Adjust the printer settings if necessary...

' Print the report using the printer settings.
ReportProcessor.Print(reportDocument, printerSettings)

Prints a report document using the specified printer settings.

C#
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, CancellationToken cancellationToken)
Parameters:reportSourceReportSource

Specifies the ReportSource for the report document to print.

printerSettingsPrinterSettings

Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

cancellationTokenCancellationToken

Specifies the CancellationToken instance that could be used to cancel the report rendering.

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
cs
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
    = new System.Drawing.Printing.PrinterSettings();

// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor
    = new Telerik.Reporting.Processing.ReportProcessor();

reportProcessor.PrintController = standardPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

System.Threading.CancellationTokenSource cancellationTokenSource =
    new System.Threading.CancellationTokenSource();

reportProcessor.PrintReport(typeReportSource, printerSettings, cancellationTokenSource.Token);
vb
Dim reportName = "ReportCatalog, VB.ReportLibrary"

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' The standard print controller comes with no UI
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController

' Create a report source to pass the report to the report processor
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName
Dim cancellationTokenSource As New System.Threading.CancellationTokenSource()

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor reportProcessor.PrintController = standardPrintController reportProcessor.PrintReport(typeReportSource, printerSettings, cancellationTokenSource.Token) 

Prints a report document using the specified printer settings and output format.

C#
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat, CancellationToken cancellationToken)
Parameters:reportSourceReportSource

Specifies the ReportSource for the report document to print.

printerSettingsPrinterSettings

Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

outputFormatstring

Specifies the output format to be used when printing the document. If not specified, the EMF format will be used.

cancellationTokenCancellationToken

Specifies the CancellationToken instance that could be used to cancel the report rendering.

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
cs
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
    = new System.Drawing.Printing.PrinterSettings();

// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor
    = new Telerik.Reporting.Processing.ReportProcessor();

reportProcessor.PrintController = standardPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

string outputFormat = "PNG";

System.Threading.CancellationTokenSource cancellationTokenSource =
    new System.Threading.CancellationTokenSource();

reportProcessor.PrintReport(typeReportSource, printerSettings, outputFormat, cancellationTokenSource.Token);
vb
Dim reportName = "ReportCatalog, VB.ReportLibrary"

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' The standard print controller comes with no UI
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController

' Create a report source to pass the report to the report processor
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName
Dim outputFormat As String = "PNG"
Dim cancellationTokenSource As New System.Threading.CancellationTokenSource()

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor reportProcessor.PrintController = standardPrintController reportProcessor.PrintReport(typeReportSource, printerSettings, outputFormat, cancellationTokenSource.Token) 

Prints a report document using the specified printer settings and output format.

C#
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat)
Parameters:reportSourceReportSource

Specifies the ReportSource for the report document to print.

printerSettingsPrinterSettings

Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

outputFormatstring

Specifies the output format to be used when printing the document. If not specified, the EMF format will be used.

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
cs
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
    = new System.Drawing.Printing.PrinterSettings();

// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor
    = new Telerik.Reporting.Processing.ReportProcessor();

reportProcessor.PrintController = standardPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

string outputFormat = "PNG";

reportProcessor.PrintReport(typeReportSource, printerSettings, outputFormat);
vb
Dim reportName = "ReportCatalog, VB.ReportLibrary"

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' The standard print controller comes with no UI
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController

' Create a report source to pass the report to the report processor
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName
Dim outputFormat As String = "PNG"

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor reportProcessor.PrintController = standardPrintController reportProcessor.PrintReport(typeReportSource, printerSettings, outputFormat) 

Prints a report document using the specified printer settings.

C#
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings)
Parameters:reportSourceReportSource

Specifies the ReportSource for the report document print.

printerSettingsPrinterSettings

Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
cs
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
    = new System.Drawing.Printing.PrinterSettings();

// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor
    = new Telerik.Reporting.Processing.ReportProcessor();

reportProcessor.PrintController = standardPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

reportProcessor.PrintReport(typeReportSource, printerSettings);
vb
Dim reportName = "ReportCatalog, VB.ReportLibrary"

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' The standard print controller comes with no UI
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController

' Create a report source to pass the report to the report processor
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor reportProcessor.PrintController = standardPrintController reportProcessor.PrintReport(typeReportSource, printerSettings) 

Renders a report in the specified format

C#
[Obsolete("The static (Shared) ReportProcessor.Render method is now obsolete. Please create an instance of the ReportProcessor class and use the RenderReport method.")]
public static bool Render(string format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, out string documentName)
Parameters:formatstring

Export format

reportDocumentIReportDocument

Report document to render

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

createStreamCallbackCreateStream

The delegate function to call to get a stream to render into.

documentNamestring

The name of the created document.

Returns:

bool

True if the rendering succeeds.

Renders a report in the specified format

C#
[Obsolete("The static (Shared) ReportProcessor.Render method is now obsolete. Please create an instance of the ReportProcessor class and use the RenderReport method.")]
public static bool Render(string format, IReportDocument report, Hashtable deviceInfo, CreateStream createStreamCallback)
Parameters:formatstring

Export format

reportIReportDocument

Report document to render

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

createStreamCallbackCreateStream

The delegate function to call to get a stream to render into.

Returns:

bool

True if the rendering succeeds.

Renders a report in the specified format

C#
[Obsolete("The static (Shared) ReportProcessor.Render method is now obsolete. Please create an instance of the ReportProcessor class and use the RenderReport method.")]
public static byte[] Render(string format, IReportDocument report, Hashtable deviceInfo, out string mimeType, out string extension, out Encoding encoding)
Parameters:formatstring

Export format

reportIReportDocument

Report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

mimeTypestring

The MIME type of the result buffer.

extensionstring

The file extension of the result buffer.

encodingEncoding

The character encoding of the result buffer.

Returns:

byte[]

Byte array that contains the rendered report.

Renders a report in the specified format

C#
[Obsolete("The static (Shared) ReportProcessor.Render method is now obsolete. Please create an instance of the ReportProcessor class and use the RenderReport method.")]
public static byte[] Render(string format, IReportDocument report, Hashtable deviceInfo, out string mimeType, out string documentName, out string extension, out Encoding encoding)
Parameters:formatstring

Export format

reportIReportDocument

Report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

mimeTypestring

The MIME type of the result buffer.

documentNamestring

The name of the created document.

extensionstring

The file extension of the result buffer.

encodingEncoding

The character encoding of the result buffer.

Returns:

byte[]

Byte array that contains the rendered report.

Renders a report in the specified format.

C#
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CancellationToken cancellationToken)
Parameters:formatstring

Export format. See Rendering Extensions help article for available export formats.

reportSourceReportSource

The ReportSource for the report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

cancellationTokenCancellationToken

A CancellationToken instance that allows to cancel the current rendering.

Returns:

RenderingResult

Renders a report in the specified format.

C#
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, CancellationToken cancellationToken, out string documentName)
Parameters:formatstring

Export format. See Rendering Extensions help article for available export formats.

reportSourceReportSource

The ReportSource for the report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

createStreamCallbackCreateStream

The delegate function to call to get a stream to render into.

cancellationTokenCancellationToken

A CancellationToken instance that allows to cancel the current rendering.

documentNamestring

The name of the created document.

Returns:

bool

True if the rendering succeeds.

Renders a report in the specified format.

C#
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, out string documentName)
Parameters:formatstring

Export format. See Rendering Extensions help article for available export formats.

reportSourceReportSource

The ReportSource for the report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

createStreamCallbackCreateStream

The delegate function to call to get a stream to render into.

documentNamestring

The name of the created document.

Returns:

bool

True if the rendering succeeds.

Renders a report in the specified format.

C#
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo)
Parameters:formatstring

Export format. See Rendering Extensions help article for available export formats.

reportSourceReportSource

The ReportSource for the report document to render.

deviceInfoHashtable

Contains parameters to pass to the rendering extension.

Returns:

RenderingResult

Events

Occurs when a processing exception is raised.

C#
public event ErrorEventHandler Error