I need to create a report that can merge with more than one report, but when one of them has a lot of data, the report is blank.
I went to your publishing page and generated the following project: which resulted in the following code for the app.component.ts:
Code: Select all
import { Component } from '@angular/core';
import { ViewEncapsulation } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
declare var Stimulsoft: any;
@Component({
selector: 'app-root',
template: `<div>
<h2>Stimulsoft Reports.JS - Report.mrt - Viewer</h2>
<div id="viewerContent"></div>
</div>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
options: any = new Stimulsoft.Viewer.StiViewerOptions();
viewer: any = new Stimulsoft.Viewer.StiViewer(this.options, 'StiViewer', false);
ngOnInit() {
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localization/en.xml", true);
var report = Stimulsoft.Report.StiReport.createNewReport();
report.loadFile("reports/Report.mrt");
report.dictionary.databases.clear();
var dsBalancete = new Stimulsoft.System.Data.DataSet();
dsBalancete.readJsonFile("data/Balancete.json");
report.regData("Balancete", null, dsBalancete);
this.options.appearance.fullScreenMode = true;
this.options.toolbar.displayMode = Stimulsoft.Viewer.StiToolbarDisplayMode.Separated;
this.viewer.report = report;
this.viewer.renderHtml("viewerContent");
}
constructor(private http: HttpClientModule) {
}
}
Code: Select all
import { Component } from '@angular/core';
import { ViewEncapsulation } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
declare var Stimulsoft: any;
@Component({
selector: 'app-root',
template: `<div>
<h2>Stimulsoft Reports.JS - Balancete.mrt - Viewer</h2>
<div id="viewerContent"></div>
</div>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
options: any = new Stimulsoft.Viewer.StiViewerOptions();
viewer: any = new Stimulsoft.Viewer.StiViewer(this.options, 'StiViewer', false);
ngOnInit() {
const informacoesRelatorio = /*JSON HERE!!!!!*/[];
let relatorios: any[] = []
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localization/en.xml", true)
informacoesRelatorio.forEach(informacaoRelatorio => {
const relatorio = Stimulsoft.Report.StiReport.createNewReport()
relatorio.loadFile('reports/' + informacaoRelatorio.nomeRelatorio + '.mrt')
relatorio.dictionary.databases.clear()
var dataBaseRelatorio = new Stimulsoft.System.Data.DataSet()
dataBaseRelatorio.readJson(informacaoRelatorio.json)
relatorio.regData(informacaoRelatorio.dataBaseRelatorio, null, dataBaseRelatorio)
relatorios.push(relatorio)
});
var reportMerge = new Stimulsoft.Report.StiReport()
reportMerge.reportUnit = relatorios[0].reportUnit
reportMerge.renderAsync()
reportMerge.renderedPages.clear()
relatorios.forEach(relatorio => {
relatorio.renderAsync(function () {
for (var index = 0; index < relatorio.renderedPages.count; ++index) {
reportMerge.renderedPages.add(relatorio.renderedPages.getByIndex(index))
}
})
})
this.options.appearance.fullScreenMode = true
this.options.toolbar.displayMode = Stimulsoft.Viewer.StiToolbarDisplayMode.Separated
this.options.toolbar.viewMode = Stimulsoft.Viewer.StiWebViewMode.Continuous
this.options.toolbar.showFullScreenButton = false
this.options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Pdf
this.viewer.report = reportMerge
this.viewer.renderHtml('viewerContent')
}
constructor(private http: HttpClientModule) {
}
}
Thank you