[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Document.PageDocument.Render

Render Method

Render(IRenderingExtension, StreamProvider)

Renders a report using the specified rendering extension and output configuration.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams)
Parameters
Type Name Description
IRenderingExtension renderingExtension

The IRenderingExtension used to render a report.

StreamProvider streams

The StreamProvider to store the rendered report output.

Examples
var renderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
DirectoryInfo di = new DirectoryInfo(@"D:\Report");
FileStreamProvider stream = new FileStreamProvider(di, "MyReport");
pageReport.Document.Render(renderingExtension, stream);
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if a report-specific error occurred.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.

Render(IRenderingExtension, StreamProvider, NameValueCollection)

Renders a report using the specified rendering extension with the specified values.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings)
Parameters
Type Name Description
IRenderingExtension renderingExtension

The IRenderingExtension used to render a report.

StreamProvider streams

The StreamProvider to store the rendered report output.

NameValueCollection settings

The NameValueCollection that contains the settings for the IRenderingExtension.

Examples
Settings settings = new Settings();
settings.HideToolbar = true;
settings.HideMenubar = true;
settings.HideWindowUI = true;
settings.Author = "Joe Smith";
PdfRenderingExtension renderingExtension = new PdfRenderingExtension();
DirectoryInfo di = new DirectoryInfo(@"D:\Report");
FileStreamProvider exportfile = new FileStreamProvider(di, "MyReport");
pageReport.Document.Render(renderingExtension, exportfile, settings);
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if a report-specific error occurred.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.

Render(IRenderingExtension, StreamProvider, NameValueCollection, bool)

Renders a report using the specified rendering extension with the specified values and refreshed data.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, bool forceDataRefresh)
Parameters
Type Name Description
IRenderingExtension renderingExtension

The IRenderingExtension used to render a report.

StreamProvider streams

The StreamProvider to store the rendered report output.

NameValueCollection settings

The NameValueCollection that contains the settings for the IRenderingExtension.

bool forceDataRefresh

Set to True to force a refresh or query of the data even if the DataMap has already retrieved the required data.

Examples
Settings settings = new Settings();
settings.HideToolbar = true;
settings.HideMenubar = true;
settings.HideWindowUI = true;
settings.Author = "Joe Smith";
PdfRenderingExtension renderingExtension = new PdfRenderingExtension();
DirectoryInfo di = new DirectoryInfo(@"D:\Report");
FileStreamProvider exportfile = new FileStreamProvider(di, "MyReport");
pageReport.Document.Render(renderingExtension, exportfile, settings, true);
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if a report-specific error occurred.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.

Render(IRenderingExtension, StreamProvider, NameValueCollection, bool, bool)

Renders a report using the specified rendering extension with the specified values and refreshed data.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, bool forceDataRefresh, bool forceParameterDataRefresh)
Parameters
Type Name Description
IRenderingExtension renderingExtension

The IRenderingExtension used to render a report.

StreamProvider streams

The StreamProvider to store the rendered report output.

NameValueCollection settings

The NameValueCollection that contains the settings for the IRenderingExtension.

bool forceDataRefresh

Set to True to force a refresh or query of the data even if the DataMap has already retrieved the required data.

bool forceParameterDataRefresh

Set to True to force a refresh or query of the parameter data.

Examples
Settings settings = new Settings();
settings.HideToolbar = true;
settings.HideMenubar = true;
settings.HideWindowUI = true;
settings.Author = "Joe Smith";
PdfRenderingExtension renderingExtension = new PdfRenderingExtension();
DirectoryInfo di = new DirectoryInfo(@"D:\Report");
FileStreamProvider exportfile = new FileStreamProvider(di, "MyReport");
pageReport.Document.Render(renderingExtension, exportfile, settings, true, true);
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if a report-specific error occurred.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.

Render(IRenderingExtension, StreamProvider, NameValueCollection, bool, bool, CancellationToken)

Renders a report using the specified rendering extension with the specified values and refreshed data.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, bool forceDataRefresh, bool forceParameterDataRefresh, CancellationToken token)
Parameters
Type Name Description
IRenderingExtension renderingExtension
StreamProvider streams

The StreamProvider to store the rendered report output.

NameValueCollection settings

The NameValueCollection that contains the settings for the IRenderingExtension.

bool forceDataRefresh

Set to True to force a refresh or query of the data even if the DataMap has already retrieved the required data.

bool forceParameterDataRefresh

Set to True to force a refresh or query of the parameter data.

CancellationToken token

Allows to stop rendering

Examples
private CancellationTokenSource _cancellationTokenSource;
private async void ExportAsync(PageReport report, IRenderingExtension renderingExtension, FileStreamProvider outputProvider, NameValueCollection settings)
{
	_cancellationTokenSource = new CancellationTokenSource();
	cancelButton.Text = "Cancel";
	await Task.Run(() =>
	{
		try
		{
			report.Document.Render(renderingExtension, outputProvider, settings, false, false, _cancellationTokenSource.Token);
		}
		catch (OperationCanceledException)
		{
		}
	});
	if (_cancellationTokenSource.IsCancellationRequested)
	MessageBox.Show("Export was cancelled", "Export", MessageBoxButtons.OK, MessageBoxIcon.Information);
	_cancellationTokenSource.Dispose();
}
private void cancelExport(object sender, EventArgs e)
{
	_cancellationTokenSource?.Cancel();
}
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if a report-specific error occurred.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.

Render(IRenderingExtension, StreamProvider, NameValueCollection, bool, bool, CancellationToken, IProgress<ProgressInfo>)

Renders a report using the specified rendering extension with the specified values and refreshed data.

Declaration
public void Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, bool forceDataRefresh, bool forceParameterDataRefresh, CancellationToken token, IProgress<ProgressInfo> progress)
Parameters
Type Name Description
IRenderingExtension renderingExtension
StreamProvider streams

The StreamProvider to store the rendered report output.

NameValueCollection settings

The NameValueCollection that contains the settings for the IRenderingExtension.

bool forceDataRefresh

Set to True to force a refresh or query of the data even if the DataMap has already retrieved the required data.

bool forceParameterDataRefresh

Set to True to force a refresh or query of the parameter data.

CancellationToken token

Allows to stop rendering

IProgress<ProgressInfo> progress

The IProgress<T> of type ProgressInfo provides progress updates.

Examples
labelExport.Text = "Export started";
var control = this;
var progress = new Progress<ProgressInfo>(progressInfo =>
{
	control.BeginInvoke(new MethodInvoker(() =>
	{
		labelExport.Text = progressInfo.IsLast ? "Export is finished." : $"Exported {progressInfo.PageNumber} pages.";
	}));
});
await Task.Run(() =>
{
	report.Document.Render(renderingExtension, outputProvider, settings, false, false, CancellationToken.None, progress);
});
Exceptions
Type Condition
ArgumentNullException

Thrown if the renderingExtension or streams is null.

ReportException

Thrown if something is wrong with the structure of the report.

LicenseException

Thrown when a component cannot be granted a license.

ValidationReportException

Thrown if validation problems occurred.

ReportParameterException

Thrown when an error related to a report's parameter occurs.

OperationCanceledException

Thrown in a thread upon cancellation of an operation that the thread was executing.