Asp.net core Migirating至Stimulsoft Core
为了在Asp.net MVC中获取Pdf报告,我正在与Stimulsoft 2015合作。问题是我不知道如何转换代码,以便在Asp.net Core中使用Stimulsoft Core。Stimulsoft Core中似乎不再提供某些功能(如StiReport)Asp.net core Migirating至Stimulsoft Core,asp.net-core,stimulsoft,Asp.net Core,Stimulsoft,为了在Asp.net MVC中获取Pdf报告,我正在与Stimulsoft 2015合作。问题是我不知道如何转换代码,以便在Asp.net Core中使用Stimulsoft Core。Stimulsoft Core中似乎不再提供某些功能(如StiReport) 这是在Asp.net MVC中运行良好的代码 public ActionResult GetReportSnapshot(string sort) { StiReport report = new St
这是在Asp.net MVC中运行良好的代码
public ActionResult GetReportSnapshot(string sort)
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Reports/Jobs.mrt"));
report["@PrjectId"] = 1;
report["@OrderBy"] = sort;
report.Dictionary.Variables["title"] = new Stimulsoft.Report.Dictionary.StiVariable("title", sort);
report.Render();
MemoryStream stream = new MemoryStream();
report.ExportDocument(StiExportFormat.Pdf, stream);
stream.Position = 0;
FileStreamResult fsr = new FileStreamResult(stream, "application/pdf");
return fsr;
}
非常感谢您的帮助。您使用的是什么nuget软件包?可能是您缺少包含
StiReport
类的nuget包。(我看到他们在多个nuget包上拆分了他们的库)
也可能是他们还没有将这部分迁移到dotnetcore。
我建议您点击github repo,看看是否可以在那里找到任何信息:,或者在那里的网站上
从nuget看来,他们最近才开始迁移到dotnet core,所以我认为我的第二个建议是正确的。
在NuGet软件包
Stimulsoft.Reports.Web.NetCore
版本2018.3.5
中。
和Asp.Net核心2.0
这对我很有用,试试这个:
public IActionResult GetReportSnapshot(string sort)
{
StiReport report = new StiReport();
report.Load(@"C:\Users\Admin\Desktop\report.mrt"); // laod report
report.Render();
report["@PrjectId"] = 1;
report["@OrderBy"] = sort;
report.Dictionary.Variables["title"] = new Stimulsoft.Report.Dictionary.StiVariable("title", sort);
// Create an PDF settings instance. You can change export settings.
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
// Create an PDF service instance.
var service = new Stimulsoft.Report.Export.StiPdfExportService();
// Create a MemoryStream object.
var stream = new MemoryStream();
// Export PDF using MemoryStream.
service.ExportTo(report, stream, settings);
return File(stream.ToArray(), "application/octet-stream");
}
我使用的是stimulsoft core nuget软件包,nuget软件包管理器中只有一个.net core软件包。我认为他们已经完成了核心版本,但似乎他们仍在努力