ReportProcessor
Represents the object responsible for printing and rendering Reports.
Definition
Namespace:Telerik.Reporting.Processing
Assembly:Telerik.Reporting.dll
Syntax:
public sealed class ReportProcessor
Inheritance: objectReportProcessor
Constructors
Initializes a new instance of the ReportProcessor class.
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.
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. csvar 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);vbDim 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.
public static IReadOnlyList<string> GetAvailableRenderingExtensions()
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.
[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)
Specifies an instance of a report document to print. Both Report and ReportBook documents are supported.
printerSettingsPrinterSettingsSpecifies 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.
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, CancellationToken cancellationToken)
Specifies the ReportSource for the report document to print.
printerSettingsPrinterSettingsSpecifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.
cancellationTokenCancellationTokenSpecifies 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. csvar 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);vbDim 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.
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat, CancellationToken cancellationToken)
Specifies the ReportSource for the report document to print.
printerSettingsPrinterSettingsSpecifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.
outputFormatstringSpecifies the output format to be used when printing the document. If not specified, the EMF format will be used.
cancellationTokenCancellationTokenSpecifies 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. csvar 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);vbDim 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.
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat)
Specifies the ReportSource for the report document to print.
printerSettingsPrinterSettingsSpecifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.
outputFormatstringSpecifies 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. csvar 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);vbDim 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.
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings)
Specifies the ReportSource for the report document print.
printerSettingsPrinterSettingsSpecifies 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. csvar 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);vbDim 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
[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)
Export format
reportDocumentIReportDocumentReport document to render
deviceInfoHashtableContains parameters to pass to the rendering extension.
createStreamCallbackCreateStreamThe delegate function to call to get a stream to render into.
documentNamestringThe name of the created document.
Returns:bool
True if the rendering succeeds.
Renders a report in the specified format
[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)
Export format
reportIReportDocumentReport document to render
deviceInfoHashtableContains parameters to pass to the rendering extension.
createStreamCallbackCreateStreamThe 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
[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)
Export format
reportIReportDocumentReport document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
mimeTypestringThe MIME type of the result buffer.
extensionstringThe file extension of the result buffer.
encodingEncodingThe character encoding of the result buffer.
Returns:byte[]
Byte array that contains the rendered report.
Renders a report in the specified format
[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)
Export format
reportIReportDocumentReport document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
mimeTypestringThe MIME type of the result buffer.
documentNamestringThe name of the created document.
extensionstringThe file extension of the result buffer.
encodingEncodingThe character encoding of the result buffer.
Returns:byte[]
Byte array that contains the rendered report.
Renders a report in the specified format.
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CancellationToken cancellationToken)
Export format. See Rendering Extensions help article for available export formats.
reportSourceReportSourceThe ReportSource for the report document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
cancellationTokenCancellationTokenA CancellationToken instance that allows to cancel the current rendering.
Returns:Renders a report in the specified format.
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, CancellationToken cancellationToken, out string documentName)
Export format. See Rendering Extensions help article for available export formats.
reportSourceReportSourceThe ReportSource for the report document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
createStreamCallbackCreateStreamThe delegate function to call to get a stream to render into.
cancellationTokenCancellationTokenA CancellationToken instance that allows to cancel the current rendering.
documentNamestringThe name of the created document.
Returns:bool
True if the rendering succeeds.
Renders a report in the specified format.
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, out string documentName)
Export format. See Rendering Extensions help article for available export formats.
reportSourceReportSourceThe ReportSource for the report document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
createStreamCallbackCreateStreamThe delegate function to call to get a stream to render into.
documentNamestringThe name of the created document.
Returns:bool
True if the rendering succeeds.
Renders a report in the specified format.
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo)
Export format. See Rendering Extensions help article for available export formats.
reportSourceReportSourceThe ReportSource for the report document to render.
deviceInfoHashtableContains parameters to pass to the rendering extension.
Returns:Events
Occurs when a processing exception is raised.
public event ErrorEventHandler Error