The requested page is not available for the requested platform. You are viewing the content for Default platform.

IWebDocumentViewerReportResolver Interface

If implemented, resolves reports to display in the Web Document Viewer by their unique names.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

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

Declaration

public interface IWebDocumentViewerReportResolver
Public Interface IWebDocumentViewerReportResolver

Remarks

The default report resolver tries to load a report from a report storage based on the report's unique name.

To provide a custom report resolver, create a class that implements the IWebDocumentViewerReportResolver interface.

The following example demonstrates how to resolve a report based on its name or type name if the report with this name does not exist.

using DevExpress.XtraReports.Web.WebDocumentViewer;
using DevExpress.XtraReports.UI;
// ...

public class CustomWebDocumentViewerReportResolver : IWebDocumentViewerReportResolver {
    public CustomWebDocumentViewerReportResolver() { }

    public XtraReport Resolve(string reportUniqueName) {
        switch (reportUniqueName) {
            case "Report1":
                return new XtraReport1();
            case "Report2":
                return new XtraReport2();
            default:
                // Try to create a report using the fully qualified type name.
                Type t = Type.GetType(reportUniqueName);
                return typeof(XtraReport).IsAssignableFrom(t) ?
                    (XtraReport)Activator.CreateInstance(t) :                
                    null;                                             
        }      
    }
}

Then, register your custom report resolver at the application's startup.

  • ASP.NET WebForms and ASP.NET MVC

    using DevExpress.XtraReports.Web.WebDocumentViewer;
    
    void Application_Start(object sender, EventArgs e) {
        DefaultWebDocumentViewerContainer.Register<IWebDocumentViewerReportResolver, CustomWebDocumentViewerReportResolver>();
    }
    
  • ASP.NET Core

    using DevExpress.XtraReports.Web.WebDocumentViewer;
    
    public void ConfigureServices(IServiceCollection services) {
        // ...
        services.AddSingleton<IWebDocumentViewerReportResolver, CustomWebDocumentViewerReportResolver>();
    }
    
See Also