FastReport使用教程

FastReport使用教程FastReport使用心得一、准备1、这次开发使用的是FastReport桌面版(FastReport.NetVersion201731.16Demo)2、引用类库FastReport.

大家好,又见面了,我是你们的朋友全栈君。

FastReport使用心得

一、准备

  1、这次开发使用的是FastReport桌面版(FastReport.Net Version 201731.16 Demo)

  2、引用类库FastReport.dll、FastReport.Web.dll

二、桌面版制作报表

  1、添加数据源

    Report——Add Data Source——

    连接数据库,测试连接成功,选取数据表,字段自动带出到界面

    如果数据源中增加了额外的数据字段,需要注意字段的属性需要保持一致,Calculated属性设置为False

  2、画报表页面

    使用table,直接拖拽数据字段至指定位置即可

  3、报表文件的处理

    FastReport文件本质是XML形式的键值对,

    <Dirctionary></Dirctionary>标签下的<MsSqlDataConnection></MsSqlDataConnection>删除,注意是删除标签对。这里删除的原因是,我们是使用的是桌面版FastReport制作报表,但是是用网页版来调用文件,网页版只传DataSource给FastReport文件。

    <Dirctionary></Dirctionary>标签下的<TableDataSource>的属性需要调整,除了Name、TableName需要与提供的数据源的表名XXX对应外,还需要增加一个属性ReferenceName,值为XXX.XXX。

 三、Web程序调用文件

  用于展示报表的首页,使用ajax形式访问服务器获取数据并填充到页面内。  

  服务器数据准备

    数据查询,拼写SQL语句生成DataTable填充到DataSet中,注意表名需要与文件中的表名保持一致。

    设置报表样式,调用报表文件,并将数据填充到报表文件中。

    然后编写一个文件,将解析的结果填充到这个文件中,并将这个文件返回给展示报表的首页中。

<!DOCTYPE html>
<html lang="zh">
<head>
    <title></title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    
@Html.Raw(ViewBag.CssFile)
@WebReportGlobals.Styles()
@WebReportGlobals.Scripts()
    <style>
        #frbody {
            overflow: visible !important;
        }

        .frtoolbar {
            height: 70px !important;
            background-image: none !important;
            background-color: #fafafa !important;
        }

        .refresh_button {
            background-image: url(../../../../Content/img/刷新.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 34px !important;
        }

        .export_button {
            background-image: url(../../../../Content/img/保存.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 30px !important;
        }

        .print_button {
            background-image: url(../../../../Content/img/打印.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 30px !important;
        }

        .zoom_button {
            background-image: url(../../../../Content/img/缩放.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 30px !important;
        }

        .first_button {
            background-image: url(../../../../Content/img/首页.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 30px !important;
        }

        .prev_button {
            background-image: url(../../../../Content/img/上一页.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 41px !important;
        }

        .next_button {
            background-image: url(../../../../Content/img/下一页.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 42px !important;
        }

        .last_button {
            background-image: url(../../../../Content/img/尾页.png) !important;
            background-position: center !important;
            height: 52px !important;
            width: 30px !important;
        }
    </style>
</head>
<body class="fixed-top">
    <div id="container" class="row-fluid">
        <div id="body">
            <div class="">                
                <div class="row-fluid">
                    <div class="span12">
                        <div class="widget box light-grey">
                            <div class="widget-title">
                                <div class="tools">
                                    <a href="javascript:;" class="collapse"></a>
                                    <a href="#widget-config" data-toggle="modal" class="config"></a>
                                    <a href="javascript:;" class="reload"></a>
                                    <a href="javascript:;" class="remove"></a>
                                </div>
                            </div>
                            <div class="widget-body">
@ViewBag.WebReport.GetHtml()
                               </div>
</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
 
    </script>

</body>

</html>

    至此,工作完成。

  

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/155677.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mysql odbc下载(mysql8下载)

    1.下载JDBC驱动的MySQL官网:https://www.mysql.com/2.按步骤下载

    2022年4月10日
    28
  • vue支持es6_vue2转vue3

    vue支持es6_vue2转vue3转载:Vue2.0ES6语法降级ES5由于部分低版本的手机还不支持ES6语法,将会导致vue报错。综合了网上的各种办法,我的项目现在终于成功降级ES5.首先安装插件npminstall-Dbabel-preset-es2015babel-corebabel-preset-stage-2babel-loader编辑配置文件…

    2022年9月25日
    1
  • 音乐推荐系统(协同过滤和SVD)

    音乐推荐系统(协同过滤和SVD)python 音乐推荐系统协同过滤和 SVD 矩阵分解 importpandas home 数据提取提取用户 歌曲 播放量 triplet dataset pd read csv filepath or buffer data home train triplets txt sep t header

    2025年9月6日
    0
  • SQL数据库查询语句

    SQL数据库查询语句一、Select语句:select语句除了可以查看数据库中的表格和视图的信息外,还可以查看SQLServer的系统信息、复制、创建数据表。其查询功能强大,是SQL语言的灵魂语句,也是SQL中使用频率最高的语句。基本select语句:一个基本的select语句可以分解成三个部分:查找什么数据(select)、从哪里查找(from)、查找的条件是什么(where)。selec

    2022年5月16日
    57
  • python自定义异常和主动抛出异常(raise)

    python自定义异常和主动抛出异常(raise)前言有时候python自带异常不够用,如同java,python也可以自定义异常,并且可以手动抛出。注意,自定义异常只能由自己抛出。python解释器是不知道用户自定义异常是什么鬼的。raise语句主动抛出异常。格式:主动抛出异常终止程序raise异常名称(‘异常描述’)raiseRuntimeError(‘testError’)主动抛出这个异常,并加以解释。自定义异常pytho

    2022年10月17日
    1
  • IoU计算

    输入:vector&lt;float&gt;p1;//y1min,x1min,y1max,x1max;vector&lt;float&gt;p2;//y2min,x2min,y2max,x2max;输出:floatIoU代码:floatcomputeIoU(vector&lt;float&gt;p1,vector&lt;float&gt;p2){…

    2022年4月12日
    48

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号