首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Stimulsoft不处理列表数据

Stimulsoft不处理列表数据
EN

Stack Overflow用户
提问于 2017-05-01 08:53:19
回答 1查看 1.2K关注 0票数 1

我用Stimulsoft编写报告功能

代码语言:javascript
复制
 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 { }
    }

但是当数据从数据库获取并传递到刺激性软件时,我没有任何响应,最后收到超时错误。

我犯了什么错?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-01 14:41:16

  • dbase.Pub_City.ToList()移动到一个单独的函数,然后在这里使用它。不要对整个块使用它的using语句。
  • RegData接受DataTable。使用RegBusinessObject传递列表。
  • 也不要使用ms.GetBuffer(),因为它比原始数据大,并且包含垃圾。试一试ms.ToArray()
  • 只需一行即可替换整个导出部件:return StiMvcViewer.ExportReportResult(this.HttpContext);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43716576

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档