Stimulsoft - How to render report in asp.net core and show it in angular

我与影子孤独终老i 提交于 2019-12-13 16:22:29

问题


Stimulsoft report:

How can I render the report with its variables and parameters in asp.net core and show it in angular?

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 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?


回答1:


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();
}

So we use the result of GetReport method into component

Angular component:

this.report.load("result of GetReport method");



回答2:


Have you tried to build the same example:
https://www.stimulsoft.com/en/documentation/online/programming-manual/reports_js_binding_data.htm.

Update:
I did something like this before, what I go to is to let the client open a popup window requesting a specific MVC action that will generate the report.
Another idea is to generate the PDF and use a PDF viewer on the client to show what you already generated.



来源:https://stackoverflow.com/questions/54087229/stimulsoft-how-to-render-report-in-asp-net-core-and-show-it-in-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!