首页 > 解决方案 > 快速报告预览 - C# MVC

问题描述

下午好。我有带有参数的报告,在形成报告之前,我想进行预览。如何使用“webReport.Report.ShowPrepared()”?

item = reportDB.SelectFirst(Convert.ToInt64(showID));
reportDB.SelectBinaryFile(ref item);
var r = new FastReport.Report();
r.LoadFromString(Encoding.UTF8.GetString(item.ReportBody));
WebReport webReport = new WebReport(); 
webReport.Width = Unit.Percentage(100);  
webReport.Height = Unit.Percentage(100); 
if (1==1)//проверка на рус язык
    webReport.LocalizationFile = "~\\Translation\\Russian.frl";

SetUserInfo(ref r);

webReport.AutoWidth = true;
webReport.AutoHeight = true;

webReport.Report =r;

webReport.PrevPage();
ViewBag.WebReport = webReport.GetHtml();

标签: asp.net-mvcfastreport

解决方案


根据官方文档,如果您可以使用 Fast 报告,如下所示。首先你需要检查报告是否准备好了,如果准备返回真正的布尔值,你可以调用 showprepared() 方法。

webReport.Load("report1.frl");
webReport.Prepare(true);
webReport.ShowPrepared();

如果您想使用一些模态窗口并需要返回到之前的页面,那么您可以像下面这样使用它。

void ShowPrepared(bool modal,Form owner)

和前面的方法一样。owner 参数确定拥有预览窗口的窗口。

请从这里阅读更多内容以更好地实施它。 官方文档快速报告


推荐阅读