Embed Bold Reports® Report Server Report
To embed the classic Bold Reports® Angular Report Designer with Report Server, set the serviceUrl, serviceAuthorizationToken and reportServerUrl properties. You can then create, edit, browse, and publish reports using the Report Server built-in API service.
Follow these steps to integrate Report Server with Bold Reports® Designer version less than
v5.2.xx
Prerequisites
Before getting started with the classic Bold Reports® Report Designer, ensure that your development environment includes the following:
Install the Angular CLI
To install the Angular CLI globally on your machine for the classic Report Designer application, run the following command in Command Prompt. The Angular CLI provides the easiest way to set up Angular projects.
npm install -g @angular/cli@latestTo learn more about
angular-clicommands, see the Angular CLI repository on GitHub.
Create a new application
To create a new Angular application for the classic Report Designer, run the following command in Command Prompt.
ng new project-name
E.g : ng new reportdesignerappThe
ng newcommand prompts you for information about features to include in the initial application project. Add theAngular Routingto your angular application by enteringyin the prompt window then press Enter key. Now, choose theCSSstylesheet format using the arrow keys and then press Enter key. The Angular CLI installs the required Angular npm packages and other dependencies.
Configure Bold Reports® Report Designer in Angular CLI
The Bold Reporting packages are distributed in npm as @boldreports/angular-reporting-components.
-
To configure the classic web Report Designer component, change the directory to your application’s root folder.
cd project-name E.g : cd reportdesignerapp -
Run the following commands to install the Bold Reports® Angular library.
npm install @boldreports/angular-reporting-components --save-dev -
Also, install Bold Reports® typings by executing the following command.
npm install --save-dev @boldreports/types -
Register the
@bold-reports/typesunder thetypeRootsand add the typingsjqueryandreports.allto thetsconfig.app.jsonfile.{ ... ... "compilerOptions": { ... ... "typeRoots": [ "node_modules/@types", "node_modules/@boldreports/types" ], "types": [ "jquery", "reports.all" ] }, ... ... }If you are using Angular CLI version 7.x.x, you will get an error like
Cannot find type definition file for 'reports.all'. To resolve this error, you need to replace thenode_modules/@boldreports/typesline undertypeRootsarray intsconfig.app.jsonwith the following code"./../node_modules/@boldreports/types" -
The classic Report Designer requires a
window.jQueryobject to render the component. Import jQuery in thesrc/polyfills.tsfile, as shown in the following code sample.import * as jquery from 'jquery'; let windowInstance = (window as { [key: string]: any }); windowInstance['jQuery'] = jquery; windowInstance['$'] = jquery;
Adding CSS reference
-
Open the
angular.jsonfile from your application’s root directory. -
Refer to the classic web Report Designer component style scripts
bold.reports.all.min.cssandbold.reportdesigner.min.cssunder thestylesnode ofprojectssection, as shown in the following code example:If you are using Angular 6 or lower version project, add the changes in
angular-cli.jsonfile.
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "reportdesignerapp": { "root": "", "sourceRoot": "src", "projectType": "application", "prefix": "app", "schematics": {}, "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/reportdesignerapp", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css", "./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reports.all.min.css", "./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reportdesigner.min.css" ], "scripts": [], "es5BrowserSupport": true }, . . . . . . }In the preceding code snippet, the
materialtheme is used. You can modify the theme based on your application, refer the following syntax:./node_modules/@boldreports/javascript-reporting-controls/Content/[theme-name]/bold.reports.all.min.cssand./node_modules/@boldreports/javascript-reporting-controls/Content/[theme-name]/bold.reportdesigner.min.css
If you are using Angular CLI version 10.x.x, you will get a warning like
CommonJS or AMD dependencies can cause optimization bailouts. To resolve this warning, you need to register the Bold Reports® JavaScript files underallowedCommonJsDependenciesarray inangular.jsonfile.
. . .
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"@boldreports/javascript-reporting-controls/Scripts/bold.report-viewer.min",
"@boldreports/javascript-reporting-controls/Scripts/bold.report-designer.min",
"@boldreports/javascript-reporting-controls/Scripts/data-visualization/ej.bulletgraph.min",
"@boldreports/javascript-reporting-controls/Scripts/data-visualization/ej.chart.min"
],
. . .
. . .Adding code mirror reference
The classic Bold Reports® Report Designer requires the code mirror scripts and styles to edit the SQL queries and Visual Basic code functions with a syntax highlighter.
-
Run the following command to install the code mirror dependencies.
npm install codemirror@5.45.0 -
Open the
angular.jsonfile from your application’s root directory and refer the code mirror script and styles under thescriptsandstylesnode of theprojectssection, as in the following code example:
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "reportdesignerapp": { "root": "", "sourceRoot": "src", "projectType": "application", "prefix": "app", "schematics": {}, "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/reportdesignerapp", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css", "./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reports.all.min.css", "./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reportdesigner.min.css", "./node_modules/codemirror/lib/codemirror.css", "./node_modules/codemirror/addon/hint/show-hint.css" ], "scripts": [ "./node_modules/codemirror/lib/codemirror.js", "./node_modules/codemirror/addon/hint/show-hint.js", "./node_modules/codemirror/addon/hint/sql-hint.js", "./node_modules/codemirror/mode/vb/vb.js" ], "es5BrowserSupport": true }, . . . . . . }
Adding Report Designer component
To add the classic Bold Reports® Report Designer component, use the following steps:
-
Open the
src/app/app.module.tsfile. -
You can replace the following code snippet in the
app.module.tsfile.import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { BoldReportDesignerModule } from '@boldreports/angular-reporting-components'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; // Report viewer import '@boldreports/javascript-reporting-controls/Scripts/bold.report-viewer.min'; // Report Designer import '@boldreports/javascript-reporting-controls/Scripts/bold.report-designer.min'; // data-visualization import '@boldreports/javascript-reporting-controls/Scripts/data-visualization/ej.bulletgraph.min'; import '@boldreports/javascript-reporting-controls/Scripts/data-visualization/ej.chart.min'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, BoldReportDesignerModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } -
Open the
index.htmlfile and refer the following scripts in<head>tag.<!-- Data-Visualization --> <script src="https://cdn.boldreports.com/15.1.10/scripts/common/ej2-base.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/common/ej2-data.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/common/ej2-pdf-export.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/common/ej2-svg-base.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/data-visualization/ej2-lineargauge.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/data-visualization/ej2-circulargauge.min.js"></script> <script src="https://cdn.boldreports.com/15.1.10/scripts/data-visualization/ej2-maps.min.js"></script> -
Open the
src/app/app.component.htmlfile and initialize the classic web Report Designer. -
You can replace the following code snippet in the
app.component.htmlfile.<bold-reportdesigner id="designer" style="position: absolute;height: 550px; width: 1250px;"> </bold-reportdesigner> -
Open the
src/app/app.component.tsand replace the following code example:import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'reportdesignerapp'; public serviceUrl: string; constructor() { // Initialize the Report Designer properties here. } } -
Open the
app.component.htmland set the Bold Reports® Report Server built-in service URL to theserviceUrlproperty and assign the created token toserviceAuthorizationTokenproperties as shown in the following code example:<bold-reportdesigner id="reportDesigner_Control" style="position: absolute;height: 550px; width: 1250px;"> </bold-reportdesigner>If you get the error
'ej' is not definedafter completing the preceding configuration in Angular CLI version 7, add the following code to the file where you render the Bold Reports® components (model file). This code resolves the issue.`/// <reference types="reports.all" />`
- The Report Designer requires the
serviceAuthorizationTokento perform the API actions with Bold Reports® Report Server. Create a token for the user by using the server RESTful API, the following code is used to generate the token.
How do I configure Report Server for the classic Report Designer?
To configure Bold Reports® Report Server for the classic Angular Report Designer, set the serviceUrl, serviceAuthorizationToken and reportServerUrl values from your Report Server.
-
The Report Designer requires the
serviceAuthorizationToken,serviceUrl, andreportServerUrlto perform the API actions with Bold Reports® Report Server. You can provide the information from Report Server as follows: -
serviceUrl– Report Server Reporting Service information should be provided for this API. -
serviceAuthorizationToken– Authorization token to communicate with reportServiceUrl. -
reportServerUrl- Report Server Reporting Server information should be provided for this API.
Open the app.component.html and set the Bold Reports® Report Server built-in service URL to the serviceUrl and reportServerUrl properties and assign the created token to serviceAuthorizationToken property, as shown in the following code example:
<bold-reportdesigner
id="reportDesigner_Control"
[serviceUrl]="serviceUrl"
[reportServerUrl]="reportServerUrl"
[serviceAuthorizationToken] = "serverServiceAuthorizationToken" style="position: absolute;height: 550px; width: 1250px;">
</bold-reportdesigner>Based on the type of Report Server, you can use one of the procedures listed as follows:
Enterprise Reporting Server
-
Generate token with your user credentials and assign it to serviceAuthorizationToken. To generate the token by using credentials, refer to Generate an authentication token by using credentials.
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serverServiceAuthorizationToken: string; constructor() { this.serverServiceAuthorizationToken = 'bearer <server-token>'; } }To generate the token within an application, refer to Generate an authentication token by using the embed secret key API.
-
Set the Bold Reports® Report Server built-in service URL to the
serviceUrlproperty. TheserviceUrlproperty value should be in format ofhttps://<<Report server name>>/reporting/reportservice/api/Designer.import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serviceUrl: string; public serverServiceAuthorizationToken: string; public reportServerUrl: string; constructor() { this.serviceUrl = 'https://<your-report-server-domain>/reporting/reportservice/api/Designer'; this.serverServiceAuthorizationToken = 'bearer <server-token>'; } } -
Set the Bold Reports® Report Server built-in server URL to the
reportServerUrlproperty. ThereportServerUrlproperty value should be in format ofhttps://<<Report server name>>/reporting/api/site/<<site name>>. You can use the following complete code in yourapp.component.tsfile.import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serviceUrl: string; public serverServiceAuthorizationToken: string; public reportServerUrl: string; constructor() { this.reportServerUrl = 'https://<your-report-server-domain>/reporting/api/site/<site-name>'; this.serviceUrl ='https://<your-report-server-domain>/reporting/reportservice/api/Designer'; this.serverServiceAuthorizationToken = 'bearer <server-token>'; } }
Cloud Reporting server
-
Generate token with your user credentials and assign it to serviceAuthorizationToken. To generate the token by using credentials, refer to Generate an authentication token by using credentials.
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serviceUrl: string; public serverServiceAuthorizationToken: string; public reportServerUrl: string; constructor() { this.serverServiceAuthorizationToken = 'bearer <server-token>'; }; }To generate the token within an application, refer to Generate an authentication token by using the embed secret key API.
-
Set the Bold Reports® Report Server built-in service URL to the
serviceUrlproperty. TheserviceUrlproperty value is ahttps://service.boldreports.com/api/Designer.import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serviceUrl: string; public serverServiceAuthorizationToken: string; public reportServerUrl: string; constructor() { this.serviceUrl ='https://service.boldreports.com/api/Designer'; this.serverServiceAuthorizationToken = 'bearer <server-token>'; }; } -
Set the Bold Reports® Report Server built-in server URL to the
reportServerUrlproperty. ThereportServerUrlproperty value should be in format ofhttps://<<Report server name>>/reporting/api/. You can use the following complete code in yourapp.component.tsfile.import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public serviceUrl: string; public serverServiceAuthorizationToken: string; public reportServerUrl: string; constructor() { this.reportServerUrl = 'https://<your-report-server-domain>/reporting/api/'; this.serviceUrl ='https://service.boldreports.com/api/Designer'; this.serverServiceAuthorizationToken = 'bearer <server-token>'; }; } -
Navigate to the root of the application and run the application using the following command.
ng serve