Back to Devexpress

Open a Report in the Blazor Document Viewer

xtrareports-405631-web-reporting-blazor-reporting-web-document-viewer-open-report-in-blazor-document-viewer.md

latest3.8 KB
Original Source

Open a Report in the Blazor Document Viewer

  • Feb 09, 2026
  • 2 minutes to read

This document describes how to open a report in the Blazor Document Viewer (JavaScript-based).

Specify a Report

You can use one of the following options to load a report to the Document Viewer:

The DxDocumentViewer.ReportName / DxWasmDocumentViewer.ReportName property

Assign a report name to the ReportName property to open a report:

razor
<DxDocumentViewer ReportName="TestReport" Height="1000px" Width="100%" />

The OpenReport method

Specifies a report on the Web Document Viewer’s client side. Allows you to refresh a preview for the loaded report.

razor
<button @onclick="OpenReport">Open Report</button>  
<DxDocumentViewer @ref="dxDocumentViewer" Height="1000px" Width="100%">  
</DxDocumentViewer>  

@code {  
DxDocumentViewer dxDocumentViewer; 

void OpenReport() {  
    dxDocumentViewer.OpenReport("HelloWorld");  
    }  
}

For both options, you need to implement and register report name resolution services. For additional information, refer to the following section:

Use Report Name Resolution Services

If you pass a report name to a method that opens a report, you must implement and register one of the following services (to resolve report names).

Note

In Blazor WebAssembly Standalone applications, use async services.

IReportProvider / IReportProviderAsyncA recommended service for the Document Viewer and Report Designer. The primary advantage of IReportProvider service is that it can be attached to reports created at runtime. IReportProviderAsync uses asynchronous operations.ReportStorageWebExtensionThis service is called when no other report name resolution services are available. It is designed to obtain reports (stored in our REPX format) from external storage (a file or a database). Note that GetData / GetDataAsync methods return a serialized report. If you use the GetData / GetDataAsync method to specify the default parameter value for a loaded report, set the Value property to the parameter value.

Open Subreports

The XRSubreport control defines additional reports (subreports) included in the host report. The control’s ReportSource property specifies the report instance used as a subreport, and the ReportSourceUrl property specifies the report name. The ReportSourceUrl property has priority over the ReportSource property.

A subreport is opened automatically alongside the main report. To open a subreport, the Report Viewer passes the XRSubreport.ReportSourceUrl property value to available report name resolution services. Use the IReportProviderAsync service to resolve report names for both the main report and subreports.