为了在Stimulsoft中获取Asp.net报告,我使用Stimulsoft2015。问题是我不知道如何转换我的代码,以便在Asp.net核心中使用Stimulsoft核心。似乎一些功能在Stimulsoft Core (如StiReport)中不再可用。
这是在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;
}如果有任何帮助,我将不胜感激。
发布于 2017-03-16 19:11:35
您使用的是什么nuget包?可能是您缺少包含StiReport类的nuget包。(我看到他们把他们的库分成了多个nuget包)
也可能是他们还没有把这部分移植到dotnet核心上。我建议你点击那里的github repo,看看你是否可以在那里找到任何信息:https://github.com/stimulsoft,或者在那里的网站上。
从nuget的角度来看,他们最近才开始迁移到dotnet核心,所以我的第二个建议是正确的。

发布于 2019-07-10 19:21:45
在NuGet Package Stimulsoft.Reports.Web.NetCore 2018.3.5版本中。和Asp.Net core 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");
}https://stackoverflow.com/questions/42828043
复制相似问题