本篇博客将介绍如何在WPF中使用ReportViewer控件。
1. 环境准备:下载安装最新版ReportViewer(PS:需要安装Microsoft SQL Server System CLR Types package);如果您的开发工具是Visual Studio 2015,记得安装Microsoft SQL Server Tools,因为需要安装ReportViewer报表设计器。
2. 下面我们通过一个例子(示例图书品种报表)来演示,
1). 新建一个WPF项目WPFBooksReport,
2). 添加Entities文件夹,并添加Book类,
public class Book { public string Name { get; set; } 黄色别墅http://www.326dy.com/ public string Author { get; set; } 326电影网http://www.326dy.com/ public string ISBN { get; set; } public decimal Price { get; set; } }
3). 添加名称为BookReport的RDLC报表,
性喜剧http://www.326ys.com/