没有 表,就不可能在任何生活领域开展业务。无论是钢厂还是学校的院系人员——到处都需要 表:会计、统计、运营等等。由于现代世界高度计算机化, 表也以电子方式进行。如果没有特殊程序—— 表生成器,创建大量 表将非常困难。
设置在线设计器的分步手册。
1. 首先,让我们从安装路径中复制一个包含在线设计器(默认为:WebReportDesigner)的文件夹到Web应用程序根目录。
2. 然后检查web.config文件,查看WebReport功能所需的处理程序设置。
for IIS6:
<system.web>…<httpHandlers><addpath="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/></httpHandlers></system.web>for IIS7:<system.webServer><handlers><addname="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/></handlers></system.webServer>
3. 然后检查WebReportDesigner/scripts/configdata.js文件中 告设计器的设置。
'getReportByUUIDFrom': '/FastReport.Export.axdetReport=','saveReportByUUIDTo': '/FastReport.Export.axdutReport=','makePreviewByUUID': '/FastReport.Export.axdakePreview=',
这些参数应包含处理程序FastReport相对于 站根的路径。如果你的路径与所写的不同,必须加以纠正,例如:
'getReportByUUIDFrom': '/oursite/FastReport.Export.axdetReport=',
4. 当WebReport在ASPX标记中使用时,你需要在页面上拖放该对象并设置属性。对于MVC,你需要在控制器中编写代码:
webReport.DesignReport = true;
webReport.ID = "MyDesignReport1";
webReport.DesignScriptCode = false;
4.4. 指定 告设计器主文件的路径,带有设计器的文件夹应被复制到Web-Application的适当位置:
webReport.DesignerPath = "~/WebReportDesigner/index.html";
4.5. 在 站上设置回调页面的路径,在 告被保存到临时文件夹后执行调用。例如,MVC的视图路径(你必须在控制器中创建新的空白视图,专门用于同名的回调):
webReport.DesignerSaveCallBack = "~/Home/SaveDesignedReport";
or, for ASPX:
webReport.DesignerSaveCallBack = "~/DesignerCallBack.aspx";
在GET请求中发送的以下参数:
reportID="here is webReport.ID"&reportUUID="here is saved report file name"
在这种情况下,reportID对应于WebReport.ID对象,而reportUUID是存储在临时文件夹中的文件名。开发者应执行进一步的操作,将 告保存到磁盘、数据库或云存储的源文件中。命名为reportUUID的临时文件在保存后必须从临时文件夹中删除。你可以使用POST查询来进行 告文件的回调传输,请阅读下面4.6节的内容。下面是代码回调页面的例子:
webReport.DesignerSavePath = "~/App_Data/DesignedReports";
你可以将属性webReport.DesignerSavePath设置为空白字符串来激活POST模式。
4.7. 设置WebReport对象在服务器缓存中的寿命,以分钟为单位,默认为60:
webReport.CacheDelay = 120;
5.1. 如果你使用ASPX布局,你需要在Page_Load事件处理程序中添加以下代码:
protected void Page_Load(object sender, EventArgs e){string reportID = Request.QueryString["reportID"];string reportUUID = Request.QueryString["reportUUID"];// 1. ReportID value identifies the object that caused the designer. The value correspondsto the property webReport.ID, which was filled by a call of the designer.// 2. Combining the path that we have filled in the property webReport.DesignerSavePath,and the resulting reportUUID, we get the path to the temporary file with edited report.// 3. This file can be opened and resaved in the appropriate place (another file, cloud, adatabase, etc).// 4. The temporary file must be deleted after saving.}
5.2. 在MVC标记中,你需要在控制器中创建一个方法和一个空的视图。控制器中的代码:
{// 1. ReportID value identifies the object that caused the designer. The value correspondsto the property webReport.ID, which was filled by a call of the designer.// 2. Combining the path that we have filled in the property webReport.DesignerSavePath,and the resulting reportUUID, we get the path to the temporary file with edited report.// 3. This file can be opened and resaved in the appropriate place (another file, cloud, adatabase, etc).// 4. The temporary file must be deleted after saving.return View();}
5.3. 你可以为在线设计器使用任何本地化:
webReport.DesignerLocale = "en";
(“en “可以改成任何其他支持的语言,支持的语言的完整列表类似于设计器发布包中 “locales “文件夹中的文件)。
当在回调页面创建处理程序时,注意过滤和检查Get/POST请求中的参数。一定要检查它们是否为空值。
使用On-line Designer的最佳位置是在页面的底部。建议宽度为100%或至少930px。建议对象的高度至少是600px。
如果您对FastReport感兴趣,欢迎加入FastReport QQ交流群:702295239
还想要更多吗可以点击阅读【FastReport 表2020最新资源盘点】,查找需要的教程资源。让人兴奋的是FastReport .NET正在 火热销售中,低至3701元起!>>查看价格详情
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!