如何将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 里面的方法就可以了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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:\Users\Desktop\FastReportOnlineDesign\FastReportOnlineDesign\FastLayOut\Simple 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  

 

posted @   LowKeyC  阅读(1467)  评论(7编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
有志者事竟成破釜沉舟百二秦关终属楚苦心人,天不负,卧薪尝胆,三千越甲可吞吴
点击右上角即可分享
微信分享提示