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 ...
随机推荐
- webApp 阅读器项目实践
这是一个webApp 阅读器的项目,是慕课网的老师讲授的一个实战,先给出项目源码在GitHub的地址:https://github.com/yulifromchina/MobileWebReader. ...
- PHP读取日志里数据方法理解
需要函数: fopen($file, "r")打开文件 fgets($file, 1024 * 10)读取一行,注意设置字节数大小,默认的1024B可能太小了 strpos($lo ...
- static/final
- Abstract Server模式,Adapter模式和Bridge模式
简易的台灯 Abstract Server模式 谁拥有接口. 接口属于它的客户,而不是它的派生类. 接口和客户之间的逻辑关系,强于接口和其派生类的逻辑关系. 逻辑关系和实体关系的强度是不一致的.在实体 ...
- Python:常用函数封装
def is_chinese(uchar): """判断一个unicode是否是汉字""" if uchar >= u'\u4e00' ...
- [leetcode]Find Minimum in Rotated Sorted Array @ Python
原题地址:https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array/ 解题思路:话说leetcode上面的二分查找题目 ...
- Linux--U盘安装Ubuntu12.04
前言 最近一直在研究Android内核驱动开发的相关事宜,使用VMware虚拟机虽然可以更方便的开发,但是对于开发环境硬件的要求还是比较高的,若用于开发,效率太低了,所以考虑使用单独PC去装载Linu ...
- jackson json转实体 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException
jackson 2.2.2 由于vo中缺少json的某个字段属性引起 2种解决方法 1:vo中添加注解@JsonIgnoreProperties(ignoreUnknown = true) 2. m ...
- [转] js == 与 === 的区别
1.对于string,number等基础类型,==和===是有区别的 1)不同类型间比较,==之比较“转化成同一类型后的值”看“值”是否相等,===如果类型不同,其结果就是不等 2)同类型比较,直接进 ...
- puma vs passenger vs rainbows! vs unicorn vs thin 适用场景 及 performance
ruby的几个web server,按照开发活跃度.并发方案及要点.适用场景等分析puma vs passenger vs rainbows! vs unicorn vs thin. 1. thin: ...