使用 Stimulsoft 报告 Asp.net 核心中的数据

Use Stimulsoft for reporting data in Asp.net core

当我与 Windows Form Application C# 一起工作时。报告使用 Stimulsoft 并使用此代码显示视图报告数据。

StiReport rpt2 = new StiReport();
rpt2.Load(Application.StartupPath + "\RPT\RPTListPoorsantNamayandeh.mrt");

rpt2.Compile();
rpt2["namayandeh"] = comboPoorsantNamayandeh.Text;
rpt2["StTarikh"] = StTarikh;
rpt2["EnTarikh"] = EnTarikh;
rpt2["tarikhGozaresh"] = tarikhGozaresh;
rpt2["GozareshCode"] = GozareshCode;
rpt2.RegData(dtRPTPoorsant);
rpt2.Render();
rpt2.Show();

上面的代码是正确的,现在我正在使用 Asp.net 核心,为了报告数据我想使用 Stimulsoft。在下面的示例中显示报告文件,但我不知道如何我可以将数据集或数据表或模型发送到 mrt 文件吗

控制器:

 public IActionResult GetReport()
        {          
            string reportString = System.IO.File.ReadAllText(_hostEnvironment.WebRootPath + "\Reoprt\ParametersSelectingCountry.mrt");
            return StiNetCoreViewer.GetReportResult(this, reportString);
        }

        public IActionResult ViewerEvent()
        {
            return StiNetCoreViewer.ViewerEventResult(this);
        }

index.chstml

@using Stimulsoft.Report.NetCore
@Html.Stimulsoft().StiNetCoreViewer("NetCoreViewver1",new StiNetCoreViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent"
    }
})
  • .NET Core 1.x 不支持 DataTableDataSet。它们将添加到 v2.x。
  • RegData 接受 DataTable。使用 RegBusinessObject 传递列表。