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="0" />
      <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="0" />
      <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(100); //
            webReport.Height = Unit.Percentage(100);// ;
            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 1=0 BEGIN
    SET FMTONLY OFF
END  

否则提示#temp无效

这里是通过程序后台传递参数,所以要注意一下

1.

2.

3.

PS:还有一点需要强调,FastReport数据源可以直接加载,不需要后台传递DataSet也是可以加载的,但要保证存储过程的正确性

附上FastReport可用版本http://download.csdn.net/detail/anbylau2130/9608832

时间: 2024-08-04 11:44:02

FastReport.Net在Rozor中的应用的相关文章

如何在FastReport .Net 2018.2中使用SVGObject

下载FastReport最新版 SVG格式(可缩放矢量图形)是在90年代后期开发的,用于在网站中显示矢量图形,其基本思想是使用XML来描述图像.这使得SVG在Web图形中非常流行,使用css或java脚本,可以轻松更改图像的XML描述.基于此,用户可以确定与Web图形中流行的其他格式(如png和gif)相比的主要优缺点. 优点: 小尺寸 灵活性,使用CSS,用户可以快速更改图形设置,例如背景颜色或页面上徽标的位置 能够在不改变质量的情况下调整图像大小. 缺点: 如果对象由大量小元素组成,则文件比

如何在FastReport VCL 6中使用交互式地图

随着Google地图的出现,交互式地图变得非常流行.它们允许您导航地图,放大和缩小以及其他许多功能.随着FastReport VCL 6的发布,这些地图可以嵌入到报告中.为此,您必须以两种可用格式之一获取地图,并使用地图对象将其插入到报告中. 您可以使用.shp和.osm格式的地图,以及.gpx格式的gps轨道. .shp - ShapeFile格式.这是存储矢量地理信息数据的特殊格式.它由美国公司ESRI在20世纪90年代开发.目前,它是地理信息系统中最常用的格式. 其实ShapeFile不是

FastReport教程:如何在单页应用程序Angular 7中使用Web报表

下载FastReport.Net最新版本 如果您在ASP.Net Core应用程序中使用FastReport.Net并希望切换到单页应用程序(SPA),那么本文适合您. 由于Angular和ASP.Net Core的共生,您可以使用您熟悉的MVC应用程序架构. 我们来看看创建SPA应用程序的方法.这对那些刚刚学习Angular的人很有用.要使用Angular,您需要安装Node.js,这是一个在服务器端执行JavaScript代码的平台. 最简单的方法是从开发人员的网站https://nodej

FastReport经验

1.FastReport中如果访问报表中的对象?可以使用FindObject方法.TfrxMemoView(frxReport1.FindObject(’memo1′)).Text:=’FastReport’; 2.FastReport中如何使用上下标?设置frxmemoview.AllowHTMLTags := True;在Text输入如下上标:mm<sup>2</sup>下表:k<sub>6</sub>举一反三,你还可以使用其他HTML标记. 3.Fas

【转】FastReport问题整理

转自:http://blog.csdn.net/bdmh/article/details/4219395 1.FastReport中如果访问报表中的对象?可以使用FindObject方法.TfrxMemoView(frxReport1.FindObject(’memo1′)).Text:=’FastReport’; 2.FastReport中如何使用上下标?设置frxmemoview.AllowHTMLTags := True;在Text输入如下上标:mm<sup>2</sup>下

FastReport 使用技巧篇

FastReport 使用技巧篇 使用技巧篇 1.FastReport中如果访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject('memo1')).Text:='FastReport'; 2.FastReport中如何使用上下标? 设置frxmemoview.AllowHTMLTags:= True;在Text输入如下 上标:mm<sup>2</sup> 下表:k<sub>6</sub>

【转】FastReport经验

转自:http://www.cnblogs.com/colincode/archive/2011/03/30/1999604.html 1.FastReport中如果访问报表中的对象?可以使用FindObject方法.TfrxMemoView(frxReport1.FindObject(’memo1′)).Text:=’FastReport’; 2.FastReport中如何使用上下标?设置frxmemoview.AllowHTMLTags := True;在Text输入如下上标:mm<sup>

大揭秘!热门报表工具Fastreport和Stimulsoft最新动态都在这里

Fastreport和Stimulsoft 作为最常被提及的两个报表类的重要产品,大家也是一直都很关注他们的最新动向!是否有重要更新?是否发布了重要消息?别着急,今天小编特意为大家带来了Fastreport和Stimulsoft最新更新内容和最近动态!赶快来看看吧! 重要更新:Fastreport.Net2019.4版本发布 FastReport.Net是适用于Windows Forms,ASP.NET,MVC和.NET Core的全功能报表解决方案. 它可以在Microsoft Visual

FastReport中的frxRichView如何设置二种不同的字体 [问题点数:100分,结帖人LIULIVERYOK]

FastReport中的frxRichView如何设置二种不同的字体 [问题点数:100分,结帖人LIULIVERYOK] 在frxRichView中有几段文字,如何给第一段文字设置不同的字体? 感激大虾们能给下答案!!! 来源:http://bbs.csdn.net/topics/390952125?page=1 解答: frxReport1->LoadFromFile(L"D:\\ccrun\\123.fr3"); TfrxRichView *f = (TfrxRichVie