我用Stimulsoft编写报告功能
public ActionResult Report2()
{
Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
using (var dbase = new Entities())
{
var myCity = dbase.Pub_City.ToList();
rpt.Load(Server.MapPath("\\report\\city.mrt"));
rpt.RegData("myCity", myCity);
if (rpt.RenderedPages.Count == 0)
{
rpt.Render(new Stimulsoft.Report.Engine.StiRenderState(true));
}
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
rpt.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, ms, settings);
return File(ms.GetBuffer(), "application/pdf");
}
}
}
public Stimulsoft.Report.Export.StiPdfExportSettings settings
{
get
{
Stimulsoft.Report.Export.StiPdfExportSettings _s =
new Stimulsoft.Report.Export.StiPdfExportSettings
{
EmbeddedFonts = true,
UseUnicode = true,
ImageResolution = 300
};
return _s;
}
set { }
}但是当数据从数据库获取并传递到刺激性软件时,我没有任何响应,最后收到超时错误。
我犯了什么错?
发布于 2017-05-01 14:41:16
dbase.Pub_City.ToList()移动到一个单独的函数,然后在这里使用它。不要对整个块使用它的using语句。RegData接受DataTable。使用RegBusinessObject传递列表。ms.GetBuffer(),因为它比原始数据大,并且包含垃圾。试一试ms.ToArray()。return StiMvcViewer.ExportReportResult(this.HttpContext);https://stackoverflow.com/questions/43716576
复制相似问题