FastReport.Net在Rozor中的应用
Webconfig中配置
IIS6.0 <system.web> <httpHandlers> 下增加
<httpHandlers>
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/>
</httpHandlers>
IIS7.0后 <system.webServer> <handlers>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<remove name="FastReportHandler"/>
<add name="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</handlers> <staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" />
</staticContent> </system.webServer>
<system.web.webPages.razor>中增加节点
<add namespace="FastReport" />
<add namespace="FastReport.Web" />
在Rozor中代码
@{
ViewBag.Title = "Index";
}
@FastReport.Web.WebReportGlobals.ScriptsWOjQuery()
@FastReport.Web.WebReportGlobals.StylesWOjQuery()
<style >
.frtoolbar{
height:40px !important;
}
</style>
<div style="overflow:scroll;height:100%">
@ViewBag.WebReport.GetHtml()
</div>
Action代码
public ActionResult Index()
{
SetReport();
webReport.Width = Unit.Percentage(); //
webReport.Height = Unit.Percentage();// ;
webReport.ToolbarIconsStyle = ToolbarIconsStyle.Red;
webReport.ToolbarStyle = ToolbarStyle.Small;
webReport.ShowExports = true;
webReport.ShowToolbar = true;
webReport.ShowZoomButton = true;
webReport.ShowPrint = true;
webReport.AutoHeight = true;
ViewBag.WebReport = webReport;
return View();
}
private void SetReport()
{
string report_path = GetReportPath();
var user = (User)HttpContext.Session[Common.Constants.USER_KEY];
webReport.Report.Load(report_path + "test2.frx");
webReport.Report.Parameters.FindByName("工号").Value = user.SysOperator.LoginName;
webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black;
webReport.ShowExports = true;
webReport.ShowPrint = true;
ViewBag.WebReport = webReport;
}
private string GetReportPath()
{
string report_path = Config.ApplicationFolder;
using (XmlDocument xml = new XmlDocument())
{
xml.Load(@Server.MapPath("../../App_Data/fastReport.config"));
foreach (XmlItem item in xml.Root.Items)
if (item.Name == "Config")
foreach (XmlItem configitem in item.Items)
if (configitem.Name == "Reports")
report_path += configitem.GetProp("Path");
}
return report_path;
}
fastReport.config
<?xml version="1.0" encoding="utf-8" ?>
<Test>
<Config>
<Reports Path="\App_Data\report\"/>
</Config>
</Test>
FastReport设计
因为这里的数据源是存储过程并且用到了临时表,所有存储过程中需要增加
IF = BEGIN
SET FMTONLY OFF
END
否则提示#temp无效
这里是通过程序后台传递参数,所以要注意一下
1.
2.
3.
PS:还有一点需要强调,FastReport数据源可以直接加载,不需要后台传递DataSet也是可以加载的,但要保证存储过程的正确性
附上FastReport可用版本http://download.csdn.net/detail/anbylau2130/9608832
FastReport.Net在Rozor中的应用的更多相关文章
- FastReport 中添加二维码功能.(Delphi)
http://www.cnblogs.com/fancycloud/archive/2011/07/24/2115240.html FastReport 中添加二维码功能.(Delphi) 在实际 ...
- FastReport调用Delphi中的自定义函数(人民币大写金额)mtm
1. 在 FormCreate 中向FastReprot添加函数 (fPrint)窗口 procedure TfPrint.FormCreate(Sender: TObject); frxReport ...
- 使用FastReport打印二维码
简单介绍一下该功能所在的项目背景:C#语言编写的WPF客户端应用程序,在“结账”模块中,打印出的收款小票上需要显示一个二维码,服务生拿着小票去找顾客,顾客可以选择现金.银行卡等普通支付方式,也可以直接 ...
- FastReport 使用技巧篇
使用技巧篇 1.FastReport中如果访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject('memo ...
- FastReport经验
FastReport经验 1.FastReport中如果访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject(’memo1′)) ...
- FastReport问题整理(http://129.sqdj.gov.cn/?p=77)
1.FastReport中如果访问报表中的对象?可以使用FindObject方法.TfrxMemoView(frxReport1.FindObject(’memo1′)).Text:=’FastRep ...
- FastReport使用技巧
使用技巧篇 1.FastReport中如果访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject('memo ...
- FastReport的使用方法
以下是我在网上收集的 这是FastReport的主控件.它包含了调入.保存.预览和打印报表的方法.每个TfrReport控件只能包含一个单独报表. TfrReport属性描 述 DataSet-联接到 ...
- FastReport问题整理(转)
FastReport问题整理 博客分类: 软件开发 部分来自网上,部分来自网友,部分来自Demo如果有新的内容,会不断更新.. 更新历史: 2009-02-27 加入套打方案全攻略(原:jinzh ...
随机推荐
- Firefox SVG getBBox方法返回'NS_ERROR_FAILURE'错误分析
在SVG中,我们无法给Text元素设置Width和Height属性,因此无法直接获取Text元素的高和宽.如果想要给Text元素添加背景色,最简单的办法就是在Text元素的下面添加Rect,然后给Re ...
- 标签简化Spring-MVC配置
新填入@RequestMapping标签 和@org.springframework.stereotype.Controller标签 这样做就是通过标签来简化之前,对HandlerMapping的配置 ...
- Spring基本概念
spring优点: 1降低组件间耦合度,实现软件各层之间的解耦. 2可以使用容器提供的各种服务.如,事务管理服务,消息服务等等. 当我们使用容器管理事务时,开发人员就不再需要手工控制事务,也不需处理复 ...
- eclipse中gradle的使用
安装gradle gradle默认的本地缓存库在c盘user目录下的.gradle文件夹下,安装好gradle后,可以添加环境变量GRADLE_USER_HOME自定义缓存位置. 安装eclipse插 ...
- python解析json
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式. 引用 import json 编码:把一个Python对象编码转换成Json字符串 json.dumps ...
- 一個小技巧讓ipad或iphone的瀏覽器也能開啟firebug
首先複製這一段代碼 javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']& ...
- H5小游戏的坑点小结
坑点: 1) iOS 9.1 的safari中,在onTouchBegan方法中调用cc.audioEngine.playEffect播放音效是没有效果的,如果在onTouchEnded调用则是正常的 ...
- 解决连接MySql速度慢的方法
最近在Linux服务器上安装MySql5后,本地使用客户端连MySql速度超慢,本地程序连接也超慢.解决方法:在配置文件my.cnf的[mysqld]下加入skip-name-resolve. 原因是 ...
- HTML 邮件链接,超链接发邮件
在网页中可以设置如“联系我们”.“问题反馈”等所谓的邮箱链接,类似网页超链接,只是可以直接打开默认邮箱程序. 使用<a href="mailto:youEMail@xxx.yyy&qu ...
- Reservoir Sampling 蓄水池抽样算法,经典抽样
随机读取数据,如何保证真随机是不可能的,因为计算机的随机函数是伪随机的. 但是在不考虑计算机随机函数的情况下,如何保证数据的随机采样呢? 1.系统提供的shuffle函数 C++/Java都提供有sh ...