没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:郑恭琳|2017-11-21 17:39:19.000|阅读 756 次
概述:Online Designer是在Internet上创建报告的绝佳工具。 我们来看看这种情况。 您创建一个报告模板,保存它,然后......看到消息“没有保存”。 但是,哪里出错了呢? 您怎么知道错误是什么? 现在,web报告具有“调试”属性,您可以使用该属性在线报告设计器中“捕捉”错误。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
Online Designer是在Internet上创建报告的绝佳工具。 我们来看看这种情况。 您创建一个报告模板,保存它,然后......看到消息“没有保存”。 但是,哪里出错了呢? 您怎么知道错误是什么? 现在,web报告具有“调试”属性,您可以使用该属性在线报告设计器中“捕捉”错误。
我们需要启用WebReport.Debug属性,并在保存报告的方法中创建一个错误处理程序。 当调用WebReport.DesignerSaveCallBack事件时,该错误将被传递给设计器。
让我们看一下简化的online designer保存报告的过程,然后就会发生这样的情况:
我们来看一个例子。 创建一个ASP.Net MVC应用程序。
打开控制器HomeController.cs。 初步添加链接到链接中的FastReport和FastReport.Web库。 “uses”部分将包含以下链接:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.UI; using System.Runtime.Caching; using System.Text; using System.IO; using FastReport; using FastReport.Web; using FastReport.Utils; using System.Web.UI.WebControls; using FastReport.Export.Html; using FastReport.Data; using System.Net.Http.Headers; using FastReport.Export.Image; using System.Net.Http;
在索引方法中,我们将创建一个空的报表并在在线设计器(OnlineDesigner)中打开它。 但是,事先您需要在该项目中添加一个online designer。 将下载的在线设计器解压到解决方案根目录下的WebReportDesigner文件夹中:
public ActionResult Index() { WebReport webReport = new WebReport(); // Create a new web report Report report = new Report(); // Create a new report ReportPage page = new ReportPage(); // Create a new report page report.Pages.Add(page); // Add a page to the report webReport.Width = Unit.Percentage(100); // Web Report Width 100% webReport.Height = Unit.Percentage(100);// Web Report Height 100% string report_path = this.Server.MapPath("~/App_Data/");// Report folder System.Data.DataSet dataSet = new System.Data.DataSet();//Create a data set dataSet.ReadXml(report_path + "nwind.xml");// load the database into it webReport.Report = report; // Assign a blank report to the report in the program webReport.RegisterData(dataSet, "NorthWind");// Register the data source in the report webReport.DesignReport = true; // Enable report design mode webReport.DesignerPath = "~/WebReportDesigner/index.html";// Set the path to the designer webReport.DesignerSaveCallBack = "~/Home/SaveDesignedReport";// Set the view to save the reports, which we will create a little later webReport.ID = "DesignReport"; //Report id webReport.Debug = true; ViewBag.WebReport = webReport; return View(); }
现在我们需要一个在线设计器中保存报告的方法:
[HttpPost] public ActionResult SaveDesignedReport(string reportID, string reportUUID) { ViewBag.Message = String.Format("Confirmed {0} {1}", reportID, reportUUID); if (reportID == "DesignReport") { try { Stream reportForSave = Request.InputStream; string pathToSave = Server.MapPath("~/App_Data/DesignedReports/test.frx"); using (FileStream file = new FileStream(pathToSave, FileMode.CreateNew)) { reportForSave.CopyTo(file); } } catch (Exception e) { throw new Exception(e.Message); } } return View(); }
在这里,我们添加错误处理。 要将错误返回给在线设计器,您需要抛出一个异常:
throw new Exception(e.Message);
对于这个动作,我们创建一个名为SaveDesignedReport.cshtml的单独视图和下面的代码:
@ViewBag.Message
现在考虑索引页面的视图(Home-> Index.cshtml):
@{ ViewBag.Title = "Home Page"; } @ViewBag.WebReport.GetHtml();
在顶部我们显示页面的标题。 接下来,我们显示从控制器收到的报告。
在文件_Layout.cshtml中,您需要连接脚本:
@WebReportGlobals.Scripts() @WebReportGlobals.Styles()
现在您需要对两个Web配置进行更改。 这些文件被称为相同,但它们位于不同的文件夹中。 第一个位于Views文件夹中。 添加到:
…
第二个文件位于项目的根目录下。 在其中我们添加一个处理程序:
…
运行我们的应用。
转到“报告”标签。 点击“保存”。 第一次应该是成功的。 再次按保存按钮。 我们得到一个错误。 从文本中可以明显看出,具有该名称的报告模板文件已经存在。
所以我们为我们的报告和整个Web应用程序提供了一个调试工具。
产品介绍 | 下载试用 | 优惠活动 | 在线客服 | 联系Elyn
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
从 2025.2 版本开始,用于仪表板创建的 Stimulsoft 产品引入了InclusionMode属性,我们将在本文中对其进行探讨。
本文将为大家介绍如何在Telerik UI for WinForms应用中使用Kendo UI for Angular组件来交换通信和事件,欢迎下载新版组件体验!
本教程提供DevExpress WinFormsWinExplorer视图的基本信息,欢迎下载最新版组件体验!
在许多企业应用程序中,从 Visio 文件读取形状数据是一项常见需求,因为这些应用程序中的图表都包含有意义的元数据。本教程将借助Aspose.Diagram,以清晰实用的方式指导您使用 C# 读取形状数据。
用于快速高效地生成报表的附加组件
FastScriptFastScript是一个跨平台的多语言脚本引擎,帮助开发者在他们的应用程序中增加脚本功能。
FastCube VCLFASTCUBE VCL是一款有效的数据分析工具
FastReport .Net一款全功能的Windows Forms、ASP.NET和MVC报表分析解决方案。
FastQueryBuilderFastQueryBuilder是一款简单实用的可视SQL请求软件开发包。它与本地CS数据库兼容。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号