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 ...
随机推荐
- [C++] socket - 4 [线程同步 简单例子]
/*WINAPI 线程同步*/ #include<windows.h> #include<stdio.h> DWORD WINAPI myfun1(LPVOID lpParam ...
- 微软发布手机版 Sample Browser。7000多示例代码一手掌握
今天早上,Sample Browser发布其全新的Windows Phone版本.至此,自2012年相继推出Desktop版.Visual Studio版,以及2013年推出Windows Store ...
- PAAS平台构建7×24小时高可用应用的方案设计
本博客迁移到部署在jae上的独立博客系统wordpress,博客地址:点击打开独立博客.欢迎大家一起来讨论IT技术. 现在很多企业都在搭建自己的私有PAAS平台,当然也有很多大型互联网公司搭建共有PA ...
- 重拾Ajax
本来想专门学习一个Fetch API的相关知识,然后从XMLHttpRequest对象开始看起,看着看着,突然发现自己每天都在使用的ajax竟然还有好多知识点都不熟悉,细思极恐,于是乎从MDN到W3C ...
- Atitit.现实生活中最好使用的排序方法-----ati排序法总结
Atitit.现实生活中最好使用的排序方法-----ati排序法总结 1. 现在的问题 1 2. 排序的类别::插入排序//交换排序//选择排序(每次最小/大排在相应的位置 )//归并排序//基数排 ...
- atitit.提升备份文件复制速度(4) ---数据挖掘 获取回收站文件列表
atitit.) ---数据挖掘 获取回收站文件列表 1. 放入回收站的原理and 1 2. info2文件文件结构 1 3. 获得文件列表2个法: 正则表达式or解析 1 4. 路径正则表达式[a- ...
- IOS—静态方法(类方法)和实例方法
1.实例方法/动态方法 a).标识符:- b).调用方式:(实例对象 函数) c).实例方法在堆栈上. 2.静态方法/类方法 a).标识符:+ b).调用方式:(类 函数) c).静态方法 ...
- Windows Server 安装 BitLocker
打开PowerShell(管理员): C:\> Install-WindowsFeature BitLocker -Restart 安装好后,系统会自动重新启动. Windows Server ...
- shell 时间统计脚本
#!/bin/sh #Today=`date +%Y%m%d` YEAR=`echo $|cut -c -` MONTH=`echo $|cut -c -` DAY=`echo $|cut -c -` ...
- vs2012 MSDN帮助文档离线包下载安装方法
vs2012安装文件 自带的 MSDN帮助文档不全, 需要自己手动添加需要的离线文档包, 具体方法如下 1. 打开 vs2012 2. 按 ctrl + alt + F1 打开帮助文档管理器 3. 在 ...