zoukankan      html  css  js  c++  java
  • 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>

        至此,工作完成。

      

  • 相关阅读:
    LeetCode-1370 Increasing Decreasing String
    LeetCode-1221 Split a String in Balanced Strings
    Neo4j 实战(三)-- Neo4j Loads CSV Files
    Neo4j 实战(二)-- neo4j 基础语句
    Java HashMap 学习笔记
    Markdown 入门笔记
    《知识图谱方法、实践与应用》读书笔记(第一遍)
    Java 数组复制
    LeetCode-496 Next Greater Element I Solution(with Java)
    linux 同步IO: sync、fsync与fdatasync
  • 原文地址:https://www.cnblogs.com/roboot/p/11855184.html
Copyright © 2011-2022 走看看