Stimulsoft-如何在asp.net核心中呈现报告并以角度显示
问题描述:
如何在asp.net核心中呈现带有变量和参数的报表并以角度显示?
How can I render the report with its variables and parameters in asp.net core and show it in angular?
角度:
viewer: any = new Stimulsoft.Viewer.StiViewer(null, 'StiViewer', false);
report: any = new Stimulsoft.Report.StiReport();
this.report.load("the report get from my api"); // ???
this.viewer.report = this.report;
this.viewer.renderHtml('viewer');
Asp.net核心:
Asp.net core:
public async Task<IActionResult> GetReport()
{
StiReport report = new StiReport();
report.Load(@"D:\myreport.mrt"); // for example load it from local
// set parameters and variables here.it's ok
// this return does not prepare report for showing in angular.It uses for view of action
return StiNetCoreViewer.GetReportResult(this, report);
}
如何使用此方法准备报告以正确显示角度?
How do I prepare report in this method for showing correctly in angular?
答
Asp.net核心:
Asp.net core:
public async Task<IActionResult> GetReport()
{
StiReport report = new StiReport();
report.Load(@"D:\myreport.mrt");
// set parameters and variables here.it's ok
// render the report
report.Render(false);
return report.SaveDocumentJsonToString();
// OR return report.SaveDocumentToString();
}
因此我们将GetReport方法的结果用于组件
So we use the result of GetReport method into component
角度组件:
this.report.load("result of GetReport method");