Class ReportProcessor
Represents the object responsible for printing and rendering Reports.
Inheritance
Namespace: Telerik.Reporting.Processing
Assembly: Telerik.Reporting.dll
Syntax
public sealed class ReportProcessor
Constructors
ReportProcessor()
Initializes a new instance of the ReportProcessor class.
Declaration
public ReportProcessor()
Properties
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.
Declaration
public PrintController PrintController { get; set; }
Property Value
System.
|
Remarks
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.
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);
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
Print(IReportDocument, PrinterSettings)
Prints a report document using the specified printer settings.
Declaration
[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
IReport Specifies an instance of a report document to print.
Both Report
and Report |
System. Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears. |
Remarks
To prevent the Print Dialog from appearing, you should specify valid
printer settings to this method.
// 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);
' 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)
PrintReport(ReportSource, PrinterSettings)
Prints a report document using the specified printer settings.
Declaration
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings)
Parameters
Report Specifies the Report |
System. Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears. |
Remarks
To prevent the Print Dialog from appearing, you should specify valid
printer settings to this method.
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);
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)
PrintReport(ReportSource, PrinterSettings, String)
Prints a report document using the specified printer settings and output format.
Declaration
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat)
Parameters
Report Specifies the Report |
System. Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears. |
System. Specifies the output format to be used when printing the document. If not specified, the EMF format will be used. |
Remarks
To prevent the Print Dialog from appearing, you should specify valid
printer settings to this method.
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);
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)
PrintReport(ReportSource, PrinterSettings, String, CancellationToken)
Prints a report document using the specified printer settings and output format.
Declaration
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, string outputFormat, CancellationToken cancellationToken)
Parameters
Report Specifies the Report |
System. Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears. |
System. Specifies the output format to be used when printing the document. If not specified, the EMF format will be used. |
System. Specifies the CancellationToken instance that could be used to cancel the report rendering. |
Remarks
To prevent the Print Dialog from appearing, you should specify valid
printer settings to this method.
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);
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)
PrintReport(ReportSource, PrinterSettings, CancellationToken)
Prints a report document using the specified printer settings.
Declaration
public void PrintReport(ReportSource reportSource, PrinterSettings printerSettings, CancellationToken cancellationToken)
Parameters
Report Specifies the Report |
System. Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears. |
System. Specifies the CancellationToken instance that could be used to cancel the report rendering. |
Remarks
To prevent the Print Dialog from appearing, you should specify valid
printer settings to this method.
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);
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)
Render(String, IReportDocument, Hashtable, out String, out String, out String, out Encoding)
Renders a report in the specified format
Declaration
[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
System. Export format |
IReport Report document to render. |
System. Contains parameters to pass to the rendering extension. |
System. The MIME type of the result buffer. |
System. The name of the created document. |
System. The file extension of the result buffer. |
System. The character encoding of the result buffer. |
Returns
System. Byte array that contains the rendered report. |
Render(String, IReportDocument, Hashtable, out String, out String, out Encoding)
Renders a report in the specified format
Declaration
[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
System. Export format |
IReport Report document to render. |
System. Contains parameters to pass to the rendering extension. |
System. The MIME type of the result buffer. |
System. The file extension of the result buffer. |
System. The character encoding of the result buffer. |
Returns
System. Byte array that contains the rendered report. |
Render(String, IReportDocument, Hashtable, CreateStream)
Renders a report in the specified format
Declaration
[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
System. Export format |
IReport Report document to render |
System. Contains parameters to pass to the rendering extension. |
Create The delegate function to call to get a stream to render into. |
Returns
System. True if the rendering succeeds. |
Render(String, IReportDocument, Hashtable, CreateStream, out String)
Renders a report in the specified format
Declaration
[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
System. Export format |
IReport Report document to render |
System. Contains parameters to pass to the rendering extension. |
Create The delegate function to call to get a stream to render into. |
System. The name of the created document. |
Returns
System. True if the rendering succeeds. |
RenderReport(String, ReportSource, Hashtable)
Renders a report in the specified format.
Declaration
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo)
Parameters
System. Export format. See Rendering Extensions help article for available export formats. |
Report The Report |
System. Contains parameters to pass to the rendering extension. |
Returns
RenderReport(String, ReportSource, Hashtable, CancellationToken)
Renders a report in the specified format.
Declaration
public RenderingResult RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CancellationToken cancellationToken)
Parameters
System. Export format. See Rendering Extensions help article for available export formats. |
Report The Report |
System. Contains parameters to pass to the rendering extension. |
System. A CancellationToken instance that allows to cancel the current rendering. |
Returns
RenderReport(String, ReportSource, Hashtable, CreateStream, out String)
Renders a report in the specified format.
Declaration
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, out string documentName)
Parameters
System. Export format. See Rendering Extensions help article for available export formats. |
Report The Report |
System. Contains parameters to pass to the rendering extension. |
Create The delegate function to call to get a stream to render into. |
System. The name of the created document. |
Returns
System. True if the rendering succeeds. |
RenderReport(String, ReportSource, Hashtable, CreateStream, CancellationToken, out String)
Renders a report in the specified format.
Declaration
public bool RenderReport(string format, ReportSource reportSource, Hashtable deviceInfo, CreateStream createStreamCallback, CancellationToken cancellationToken, out string documentName)
Parameters
System. Export format. See Rendering Extensions help article for available export formats. |
Report The Report |
System. Contains parameters to pass to the rendering extension. |
Create The delegate function to call to get a stream to render into. |
System. A CancellationToken instance that allows to cancel the current rendering. |
System. The name of the created document. |
Returns
System. True if the rendering succeeds. |
Events
Error
Occurs when a processing exception is raised.
Declaration
public event ErrorEventHandler Error