首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Stimulsoft报告没有显示其内容。

Stimulsoft报告没有显示其内容。
EN

Stack Overflow用户
提问于 2020-03-05 14:15:12
回答 2查看 2.5K关注 0票数 1

我正在使用ASP.NET MVC Core3.1,并试图在项目中使用Stimulsoft报告。报表查看器正在运行,但无法看到报表的内容。

我能知道有什么问题吗?

结果是..。请使用下面提供的http://prntscr.com/rc1kou网址

守则如下:

控制器

代码语言:javascript
复制
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Stimulsoft.Report;
using Stimulsoft.Report.Mvc;
using WebApplication2.Models;

namespace WebApplication2.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        


        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        public IActionResult GetReport()
        {
            // Create the report object
            StiReport report = new StiReport();
            report.LoadDocument(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"));

            DataSet data = new DataSet("Demo");
            data.ReadXml(StiNetCoreHelper.MapPath(this, "Reports/Data/Demo.xml"));

            report.RegData(data);


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

.CSHTML

代码语言:javascript
复制
@using Stimulsoft.Report.Mvc;

@{
    ViewData["Title"] = "Home Page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent"
    }


})
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-03-12 17:07:54

您应该使用Load()方法而不是LoadDocument()来加载报表模板:

代码语言:javascript
复制
report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"))
票数 0
EN

Stack Overflow用户

发布于 2022-11-24 07:47:47

您应该在控制器构造函数上使用StiLicense.Key。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60547348

复制
相关文章

相似问题

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