FastReport报表MVC显示步骤
FastReport报表MVC使用步骤如下:
1、创建MVC网站项目
最终DEMO如下图所示
2、引用相关DLL
FastReport.dll
FastReport.Web.dll
3、Web.config中增加配置
<system.webServer>
<handlers>
<add name="FastReport-Export" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</handlers>
</system.webServer>
4、Action代码
public class HomeController : Controller
{
public ActionResult Index()
{
var webReport = new WebReport(); var dataPath= Server.MapPath("~/frAssets/Reports/nwind.xml");
var dataSet = new System.Data.DataSet();
dataSet.ReadXml(dataPath);
webReport.Report.RegisterData(dataSet, "NorthWind"); var reportPath = Server.MapPath("~/frAssets/Reports/SimpleList.frx");
webReport.Report.Load(reportPath); webReport.Width = Unit.Percentage();
webReport.Height = Unit.Percentage();
//设置Toobar图标样式
webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black;//ToolbarIconsStyle.Custom;
//设置Background样式
webReport.ToolbarBackgroundStyle = ToolbarBackgroundStyle.Medium;
//设置自定义按钮图片路径
webReport.ButtonsPath = "/frAssets/Buttons/";
//本地化文件
webReport.LocalizationFile = "/frAssets/Localization/Chinese (Simplified).frl";
webReport.PrintInPdf = false;
ViewBag.WebReport = webReport;
return View();
} }
5、View中引入样式
@WebReportGlobals.Scripts()
@WebReportGlobals.Styles()
6、View中添加报表呈现代码
<div id="report-wrapper">
@ViewBag.WebReport.GetHtml()
</div>
7、报表居中样式处理
<style type="text/css">
html > /**/ body .container {
margin:;
max-width: 100%;
} #report-wrapper .frtoolbar {
width: 100%;
} #report-wrapper #frbody {
text-align: center;
} #report-wrapper #frbody > div {
margin: 0 auto;
} html > /**/ body #report-wrapper span > div > div {
display: block;
text-align: center;
}
</style>
8、项目Demo源码
https://files.cnblogs.com/files/WangHuaiSheng/FastReportMvcDemo.7z
![]() |
文章作者:花生(OutMan)
发布地址:http://www.cnblogs.com/WangHuaiSheng/ 发布时间:2018年3月15日 本文版权归作者和博客园共有,欢迎转载, 但未经作者同意必须保留此段声明, 且在文章页面明显位置给出原文连接。 |
FastReport报表MVC显示步骤的更多相关文章
- 使用FastReport报表工具生成报表PDF文档
在我们开发某个系统的时候,客户总会提出一些特定的报表需求,固定的报表格式符合他们的业务处理需要,也贴合他们的工作场景,因此我们尽可能做出符合他们实际需要的报表,这样我们的系统会得到更好的认同感.本篇随 ...
- FastReport报表控件使用技巧总结
FastReport报表控件使用技巧总结 1.FastReport中如何访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject(' ...
- FastReport报表设计(仔细看)
FastReport报表设计 2011-06-16 16:56:19| 分类: 系统开发|举报|字号 订阅 下载LOFTER我的照片书 | 目录 5.1 前言 5.2 基本概念及操 ...
- FastReport报表设计
[转载]FastReport报表设计 (2012-10-24 20:37:26) 转载▼ 标签: 转载 原文地址:FastReport报表设计作者:小黑 FastReport报表设计 目录 5.1 ...
- 使用FastReport报表工具生成图片格式文档
之前我在随笔<使用FastReport报表工具生成报表PDF文档>介绍过使用FastReport.Net来根据报表模板进行生成PDF,以及随笔<使用FastReport报表工具生成标 ...
- FastReport报表对象介绍一:“Text”对象
FastReport中文网 http://www.fastreportcn.com/Article/70.html ------------------------------------------ ...
- unigui+fastreport报表打印
unigui+fastreport报表打印 unigui+fastreport报表打印 FASTREPORT导出成PDF报表,UNIGUI的TUniURLFrame显示PDF报表并打印. func ...
- Delphi FastReport报表常用方法
Delphi FastReport报表常用方法 作者及来源: EasyPass - 博客园 收藏到→_→: 摘要: Delphi FastReport报表常用方法 点击这里! ...
- 如何让Spring MVC显示自定义的404 Not Found页面
不知道大家对千篇一律的404 Not Found的错误页面是否感到腻歪了?其实通过很简单的配置就能够让Spring MVC显示您自定义的404 Not Found错误页面. 在WEB-INF的web. ...
随机推荐
- SQL字符串操作汇总
SQL字符串操作汇总 --将字符串中从某个字符开始截取一段字符,然后将另外一个字符串插入此处 select stuff('hello,world!',4,4,'****') --返回值hel*** ...
- leetcode算法:Distribute Candies
Given an integer array with even length, where different numbers in this array represent different k ...
- 基于 MySQL 的数据库实践(准备工作)
背景 本学期在北京大学选修了<数据库概论>的实验班课程,由于 SQL 语法并不是特别理论的内容,因此课上暂时也没有特别展开.出于探索数据库领域的兴趣,使用国内普遍使用的数据库软件 MySQ ...
- flask 操作mysql的两种方式-sql操作
flask 操作mysql的两种方式-sql操作 一.用常规的sql语句操作 # coding=utf-8 # model.py import MySQLdb def get_conn(): conn ...
- Java 接口基础详解
目录 Java接口示例 实现一个接口 接口实例 实现多个接口 方法签名重叠 接口变量 接口方法 接口默认方法 接口与继承 继承与默认方法 接口与多态性 在Java中,接口是一个抽象类型,有点类似于类, ...
- [LeetCode] Valid Square 验证正方形
Given the coordinates of four points in 2D space, return whether the four points could construct a s ...
- HashMap 你真的了解吗?
HashMap深入解析及详细介绍 一. hashmap简介 HashMap是基于哈希表的Map接口的非同步实现.此实现提供所有可选的映射操作,并允许使用null值和null键.此类不保证映射的顺序,特 ...
- 实验吧_天下武功唯快不破&让我进去(哈希长度拓展攻击)
天下武功唯快不破 第一反应就去抓包,看到返回包的header中有FLAG的值,base64解码后得到下图所示 这就要求我们在请求头中post相应key的值,我直接在burp中尝试了多次都没有用,想起来 ...
- [测试题]無名(noname)
Description 因为是蒯的题所以没想好名字,为什么要用繁体呢?去看<唐诗三百首>吧! 题意很简单,给你一个串,求他有多少个不同的子串,满足前缀为A,后缀为B. 需要注意的是,串中所 ...
- [SCOI2005]骑士精神
题目描述 输入输出格式 输入格式: 第一行有一个正整数T(T<=10),表示一共有N组数据.接下来有T个5×5的矩阵,0表示白色骑士,1表示黑色骑士,*表示空位.两组数据之间没有空行. 输出格式 ...