Angular component for rendering SSRS reports
npm install ngx-custom-ssrs-reportviewer
Installation ·
Usage ·
Attributes ·
Examples ·
Limitations
bash
npm install ngx-ssrs-reportviewer --save
`
or
`bash
ng add ngx-ssrs-reportviewer
`
👨🏻🏫 Usage
1. Add ReportViewerModule into your AppModule class. An example app.module.ts would look like this:
`javascript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppComponent } from './app.component';
import { ReportViewerModule } from 'ngx-ssrs-reportviewer';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ReportViewerModule
],
providers: [],
bootstrap: [AppComponent],,
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }
`
2. Add the report viewer to your components html template. An example app.component.html with all the report viewer attributes could look as follows:
`html
[reportserver]="reportServer"
[reporturl]="reportUrl"
[showparameters]="showParameters"
[parameters]="parameters"
[language]="language"
[width] ="width"
[height]="height"
[toolbar]="toolbar" >
`
NOTE: Many of these attributes are optional. I will cover which attributes are required below and what each one does.
4. Now inside your component the report viewer attributes specified in the ssrs-reportviewer component can be initialized. Initialization of all the attributes inside app.component.ts would look like this:
`typescript
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
reportServer: string = 'http://myreportserver/reportserver';
reportUrl: string = 'MyReports/SampleReport';
showParameters: string = "true";
parameters: any = {
"SampleStringParameter": null,
"SampleBooleanParameter" : false,
"SampleDateTimeParameter" : "11/1/2020",
"SampleIntParameter" : 1,
"SampleFloatParameter" : "123.1234",
"SampleMultipleStringParameter": ["Parameter1", "Parameter2"]
};
language: string = "en-us";
width: number = 100;
height: number = 100;
toolbar: string = "true";
}
``