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. ...
随机推荐
- MySql入门(2-1)windows下安装mysql的两种方式
一.下载mysql 1.下载解压MySQL 登录oracle主页,需要用户名和口令: lshengqi@netease.com/1wsx**** 下载路径:: https://dev.mysql.co ...
- EasyUI 冻结列
一.如果是js绘制的,设置frozenColumn属性就可以,frozenColumn 属性和 columns 属性都是设置列,frozenColumn是设置冻结列 $('#tt').datagrid ...
- Dapper中条件为In的写法
今天用Dapper更新是用到了IN写法,园子里找了篇文章这样写到 传统sql in (1,2,3) 用dapper就这样写 conn.Query<Users>("SELECT * ...
- ActiveMQ学习系列(三)----下载github源码并编译
前记:坚持使用官网的资源去学习是挺痛苦的一个过程,昨天瞎溜达了一天,也没看到有系统性的学习文章,倒是发现了github上的ActiveMq项目. 地址:https://github.com/apach ...
- POJ-2031 Building a Space Station---MST + 空间距离
题目链接: https://vjudge.net/problem/POJ-2031 题目大意: 就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则 ...
- linux如何安装django
首先在命令行下输入python 进入界面后先importdjango 如果这一步有错,说明没有django 需要我们安装 源码安装方法: 下载源码包 https://www.djangoproject ...
- CSS基础:内联元素
简介 内联元素由于涉及到文本字体,读写方向,汉字和字母差异等诸多方面的影响,因此其盒模型比块级元素更加复杂,对于内联非替换元素,比如一行文本,主要由以下几种框构成: "em 框", ...
- Java集合总结【面试题+脑图】,将知识点一网打尽!
前言 声明,本文用的是jdk1.8 花了一个星期,把Java容器核心的知识过了一遍,感觉集合已经无所畏惧了!!(哈哈哈....),现在来总结一下吧~~ 回顾目录: Collection总览 List集 ...
- Python进阶_mysql(1)
什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库,每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据. 进入mysql (linux ...
- laravel5.5 使用alipay SDK报错Cannot redeclare Encrypt() (previously declared in ../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:448)
错误现象: 在laravel5.5 中,使用alipaySDK 报错: Cannot redeclare Encrypt() (previously declared in ../vendor/lar ...