WebDocumentViewerExceptionHandler.GetDocumentCreationExceptionMessage(DocumentCreationException) Method

Enables you to handle errors related to the document creation process.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v21.1.Web.dll


public virtual string GetDocumentCreationExceptionMessage(
    DocumentCreationException ex


Name Type Description
ex DocumentCreationException

An exception that occurs on the server side.


Type Description

A string to show in a browser when an error occurs.


The GetDocumentCreationExceptionMessage method is called whenever an error occurs while the document creation is in process (for instance, errors in the BeforePrint or AfterPrint events of a report or specific control).

The code snippet below demonstrates how to create a descendant from the WebDocumentViewerExceptionHandler class and override the GetDocumentCreationExceptionMessage method to return a custom message.

using DevExpress.XtraReports.Web.WebDocumentViewer;

public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
    public override string GetDocumentCreationExceptionMessage(DocumentCreationException ex) {
        return "An exception occured while document creation.";

To register the implemented exception handler, use the static DefaultWebDocumentViewerContainer.Register method at the application’s startup as shown below:

void Application_Start(object sender, EventArgs e) {
    // ...
      Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();

See the following topics for more information:

See Also