xtrareports-119430-web-reporting-angular-reporting-document-viewer-document-viewer-integration-in-angular.md
The Web Document Viewer is used in applications that contain client and server parts:
ClientA Web Document Viewer integrated in a client Angular application displays a report provided by the server-side model.ServerThe server is an ASP.NET Core application that handles client data requests and provides access to data sources, report storage, and other back-end capabilities.
This tutorial creates and configures a client Angular application and a server ASP.NET Core backend. The client contains the Web Document Viewer control.
Tip
You can also use our DevExpress project templates to create an Angular Reporting application:
Node.js 18.13 or later
.NET 8 SDK or later
Angular CLI v19+ Note the following details about package versions:
The script version on the client should match the library version on the server.
DevExpress npm package versions should be identical.
You can use DevExpress CLI Templates to create an ASP.NET Core back-end application. Begin with the steps below:
Install DevExpress ASP.NET Core project templates from nuget.org:
Create a back-end Reporting application for a Document Viewer:
Enable cross-origin requests (CORS). Specify the policy that allows any local application to access the report’s back-end. Use the SetIsOriginAllowed method to set it up.
To run the server-side application, run the following command:
To create a back-end application from a Microsoft or DevExpress Template in Visual Studio, review the following help topics:
Follow the steps below to create and configure the client part:
Make sure you have the current Node.js version with npm installed on your machine.
Open the console window and install the Angular CLI v19+ globally.
Run the command to create a new Angular project:
Install the following packages:
Replace the content of the src\app\app.ts file with the following code:
Replace the content of the src\app\app.html file with the following code to add dx-report-viewer Angular component:
Run the server application.
Run the client application:
Open the http://localhost:4200/ location in the browser to see the result.
When you start the application, you may encounter the following problems:
The Document Viewer page is blank. The following error message is displayed at the bottom of the page:
Could not open report ‘TestReport’
Check the following:
host setting of the Document Viewer component.reportUrl setting value matches an existing report. For the backend application, ensure that either the Reports folder contains a reportUrl.repx file or the ReportsFactory.Reports dictionary contains the reportUrl entry (if the back-end application originated from the DevExpress template).Refer to the following topic for more information: Troubleshooting.
For information on how to identify the cause of an issue, refer to the following topic: Reporting Application Diagnostics.
Now that you’ve created a basic Angular app with a Document Viewer, you can continue to extend your application with the following features:
Client-Side ConfigurationIntegrate the Document Viewer for Web into your Angular-based application.Specify Parameter ValuesSet parameter values in the Document ViewerCustomize Toolbar and Tab PanelCustomize available Document Viewer elements. See Also