• 如何将FastReportOnlineDesign 灵活的应用到C/S B/S 程序当中?


    一.好久没有写博客了,主要是停在这里太久了,有些事情让自己尽量不在去想,忘记不了一段难以忘怀的记忆,就让这一段美好的记忆沉没在无锡的太湖中吧!不在去想了。难以忘怀。。。。。

    二.废话不多说了,不如正题,最近在一直忙于AVS 系统的开发基于C/S的。后期的客户主要想做B/S 的。需要在原来的基础上进行一键式安装部署网站到IIS上。 以及将FastReportOnlineDesign 中的报表的功能嵌入到其中的B/S 的应用程序里面。

    三.首先你需要进行建立一个B/S 方面的应用的程序。目前我就按照自己的创建的项目进行展示。

    1.首先你需要进行下载和按照一个FastReportOnlineDesign 安装包就可以了,然后将其中的程序集部分进行替换掉就可以使用了。

    2..创建一个ASP.NET MVC 5.0 方面的应用的程序。下面是创建的应用程序的核心的关于调用FastReportOnlineDesign 里面的方法就可以了。

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using FastReport;
    using FastReport.Barcode;
    using FastReport.Editor;
    using System.Data;
    using System.Threading;
    using System.IO;
    using static System.Net.Mime.MediaTypeNames;
    using FastReport.Export.Pdf;
    using System.Diagnostics;
    namespace FastReportOnlineDesign.Controllers
    {
        public class HomeController : Controller
        {
            [STAThreadAttribute]
            public ActionResult Index()
            {
                return View();
            }
            [HttpPost]
            public ActionResult Index(string Parameter)
            {
                Thread t = new Thread(new ThreadStart(DealReport));//你需要首先创建一个线程 在B/S 应用程序里面必须要这么做否则会报错。
                t.ApartmentState = ApartmentState.STA;
                t.Start();
                return View();
            }
            public ActionResult About()
            {
                ViewBag.Message = "Your application description page.";
                return View();
            }
            //对于报表的操作
            private void DealReport()
            {
                #region  进行汉化处理
                string BaseDir = Path.Combine(Application.StartupPath, "File/FastReport");
                FastReport.Utils.Res.LocaleFolder = Path.Combine(baseDir, "L18N");
                var File = FastReport.Utils.Res.LocaleFolder + @"Chinese (Simplified).frl";
                FastReport.Utils.Res.LoadLocale(File);
                #endregion
                #region  进行预览FastReport 以及设计FastReport模板
                DataSet FDataSet = new DataSet();
                DataTable table = new DataTable();
                table.TableName = "Admin";
                table.Columns.Add("AId", typeof(string));
                table.Columns.Add("Akey", typeof(string));
                table.Rows.Add(0, "ab");
                table.Rows.Add(1, "abc");
                table.Rows.Add(2, "ab");
                table.Rows.Add(3, "abc");
                FDataSet.Tables.Add(table);
                FastReport.Report report = new FastReport.Report();
                try
                {
                    //report.Load(@"C:UsersDesktopFastReportOnlineDesignFastReportOnlineDesignFastLayOutSimple List.frx");
                    report.RegisterData(FDataSet);
                    report.Design();
                    report.GetDataSource("Admin").Enabled = true;
                    report.Show();
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                finally
                {
                    report.Dispose();
                }
                #endregion
               
            }
             
        }
    }
    

    3.直接在前端页面进行应用Ajax 进行使用调用就可以了。

    4.如果在C/S 应用程序当中直接使用DealReport() 方法就可以了。 

                                                                                                                                                  2017/11/15  1:00 :00  

     

    再牛逼的梦想,也抵不住我傻逼似的坚持!别在该奋斗的年纪,贪图安逸。 今天多学一些知识,明天开发的速度就更快一下。后天你就会变得更好。
  • 相关阅读:
    大道至简第二章读后感
    读大道至第一章简有感
    二次封装Response类
    视图与序列化传参
    Codeforces Round #523 (Div. 2) F. Katya and Segments Sets (交互题+思维)
    Codeforces Round #510 (Div. 2) D. Petya and Array(离散化+反向树状数组)
    Codeforces 1060E(思维+贡献法)
    Codeforces Round #520 (Div. 2) E. Company(dfs序判断v是否在u的子树里+lca+线段树)
    Codeforces Round #513 by Barcelona Bootcamp C. Maximum Subrectangle(双指针+思维)
    Educational Codeforces Round 51 F. The Shortest Statement(lca+最短路)
  • 原文地址:https://www.cnblogs.com/LowKeyCXY/p/7839889.html
Copyright © 2020-2023  润新知