Skip to main content

Reporting for Angular

  • 4 minutes to read

The topics in this section describe how to create reporting applications based on the Angular framework.

View Example: ASP.NET Core Reporting - Best Practices (ASP.Net Core application with an Angular frontend)

Document Viewer and Report Designer for Angular require Angular v15 or later.

Document Viewer

The native Angular Document (Report) Viewer does not rely on the Knockout.js library. This allows for easier extensibility, better typing, and the capability to work with Angular templates. You can register your own Angular components as Report Viewer templates. Review the following topic for an example of using the Angular template for customization: A Custom Editor for a Custom Parameter Type.

Quick Start

Customization

Client-Side API

Client Object

Use the JSReportViewer class to access the client-side API in Angular applications.

Events

Client-side events in Angular are handled with callbacks.

Event names and data in event arguments passed to the Angular callback handler functions are the same as events in an ASP.NET Core application specified by WebDocumentViewerClientSideEventsBuilder methods.

The following code demonstrates how to use the dx-report-viewer component in a View. The code hides the Print and PrintPage commands in the toolbar, disables asynchronous search, and creates a Print button.

<div>  
  <button (click)="print()"><span>Print</span></button>  
</div> 

 <div>
    <dx-report-viewer [reportUrl]="reportUrl" height="800px" cssClass='myViewer'>
        <dxrv-request-options [invokeAction]="invokeAction" [host]="hostUrl"></dxrv-request-options>
        <dxrv-tabpanel-settings width="500" position="Left"></dxrv-tabpanel-settings>
        <dxrv-export-settings [useSameTab]="false" [useAsynchronousExport]="false"></dxrv-export-settings>
        <dxrv-search-settings [useAsyncSearch]="false"></dxrv-search-settings>
        <dxrv-callbacks 
        (CustomizeMenuActions)="CustomizeMenuActions($event)">
        </dxrv-callbacks>
    </dx-report-viewer>
</div>

Templates

You can customize Document Viewer appearance and functionality with Angular templates. Refer to the following help topic for an example: A Custom Editor for a Custom Parameter Type.

Constants and enums in typescript code may require the import directive. The following example declares the DevExpress.Reporting.Viewer.ZoomAutoBy enum:

import { ZoomAutoBy } from "devexpress-reporting/viewer/constants";

You can import the Document Viewer constants from the devexpress-reporting/dx-webdocumentviewer source, and the Report Designer constants from the devexpress-reporting/dx-reportdesigner source.

Report Designer

Quick Start

Customization

Client-Side API

Client Object

Use the JSReportDesigner class to access client-side API in Angular applications.

Events

Client-side events in Angular are handled with callbacks specified in Knockout bindings. For more information on Knockout bindings, review the following help topic: Report Designer Client-Side Configuration (Knockout Bindings)

Event names and data in event arguments passed to the Angular callback handler functions are the same as events in an ASP.NET Core application specified by ReportDesignerClientSideEventsBuilder methods.

The following code snippets demonstrate how to configure the Report Designer component in the client application:

<div>
    <button (click)="open()"><span>Open</span></button>
</div>
<div>
    <dx-report-designer [reportUrl]="reportUrl" height="700px">
        <dxrd-request-options [getDesignerModelAction]="getDesignerModelAction" [host]="hostUrl"></dxrd-request-options>
        <dxrd-callbacks (CustomizeMenuActions)="CustomizeMenuActions($event)">
        </dxrd-callbacks>
        <dxrd-designer-model-settings [allowMDI]="true">
            <dxrd-datasource-settings [allowAddDataSource]="false" [allowRemoveDataSource]="false"></dxrd-datasource-settings>
            <dxrd-preview-settings>
                <dxrv-export-settings [useSameTab]="false"></dxrv-export-settings>
                <dxrv-progressbar-settings position="TopRight"></dxrv-progressbar-settings>
                <dxrv-search-settings [useAsyncSearch]="false"></dxrv-search-settings>
            </dxrd-preview-settings>
            <dxrd-wizard-settings [useFullscreenWizard]="false" [enableSqlDataSource]="false"></dxrd-wizard-settings>
        </dxrd-designer-model-settings>
    </dx-report-designer>
</div>