WPF做Windows程序界面很好很强大,RDLC做报表免费又好用,如何将两者强强联合呢?
 
方法1:
   可以直接在WPF项目中加入一个WinForm窗体,在这个窗体上进行报表操作,与一般的WinForm编程没有什么区别。用WindowFormHost控件,直接集成报表到WPF窗体中,可以保持程序风格的一致性。
方法2:

A、引用ReportViewer的命名空间

<UserControl x:Class="CMRESTPORTAL.Reports"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:wf="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"   //很关键的一句哦
    Height="Auto" Width="Auto">
    </UserControl>

B、添加WindowsFormsHost控件

<Grid>
       < WindowsFormsHost Name="ReportsHost">

< wf:ReportViewer Name="BuildReport">
               
           < /wf:ReportViewer>
       < /WindowsFormsHost>

</Grid>

C、添加相关代码,显示报表

public Reports()
        {
            InitializeComponent();

Microsoft.Reporting.WinForms.ReportViewer rep = ReportsHost.Child as Microsoft.Reporting.WinForms.ReportViewer;
            rep.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; //远程模式
            Uri uri = new Uri("http:/reportserver");  //report所在的report server
            rep.ServerReport.ReportServerUrl = uri; 
            rep.ServerReport.ReportPath = "/ReportFolder/BuildReportForQuery";     //report所在的路径
            rep.RefreshReport();  //Calling the RefreshReport method causes all data in the report to be reloaded and rendered.

}

reporting service & wpf的更多相关文章

  1. SQL Server性能计数器收集汇总方案(Reporting Service)

    通过收集计数器信息,并将计数器信息汇总为不同粒度存储,以Reporting Service报表服务器显示.以下是计数器收集汇总的基本架构. 笔者需要收集的SQL Server计数器包括:SQL Ser ...

  2. Reporting Service 服务启动时报错The service did not respond to the start or control request in a timely fashion

    案例环境: 启动一台数据库服务器(Windows Server 2003)的Reporting Service(SQL Server 2008 R2)服务时,出现如下错误信息: System.Inva ...

  3. 数据库服务器改名导致Reporting Service不可用的案例

    案例环境: 操作系统版本    :    Windows Server 2012 R2 Standard 数据库版本      :   SQL Server 2012 Standard Edition ...

  4. Reporting Service 告警"w WARN: Thread pool pressure. Using current thread for a work item"

    如果Reporting Service偶尔出现不可访问或访问出错情况,这种情况一般没有做监控的话,很难捕捉到.出现这种问题,最好检查Reporting Service的日志文件. 今天早上就遇到这样一 ...

  5. SQL Server Reporting Service(SSRS) 第二篇 SSRS数据分组Parent Group

    SQL Server Reporting Service(SSRS) 第一篇 我的第一个SSRS例子默认使用Table进行简单的数据显示,有时为了进行更加直观的数据显示,我们需要按照某个字段对列表进行 ...

  6. SQL Server Reporting Service(SSRS) 第一篇 我的第一个SSRS例子

    很早就知道SQL SERVER自带的报表工具SSRS,但一直没有用过,最近终于需要在工作中一展身手了,于是我特地按照自己的理解做了以下总结: 1. 安装软件结构 SSRS全称SQL Server Re ...

  7. Reporting Service 配置SMTP和设置订阅出现的异常

    SSRS能够按照schedule,以mail的形式发送report,这是通过设置subscription report来实现的. 1,发送mail需要在SSRS中配置SMTP Server,如果没有R ...

  8. Reporting Service 没有权限登陆

    在配置好Reporting Service之后,登陆Report Mananger( http://localhost/Reports/Pages/Folder.aspx)出现一个异常,本地用户没有权 ...

  9. 【解决】SharePoint集成模式下Reporting Service—为用户授予的权限不足,无法执行此操作。 (rsAccessDenied)

    环境:Windows Server 2008 R2 SP1,SharePoint 2010 企业版,SQL Server 2008 R2 Reporting Service(SharePoint集成模 ...

随机推荐

  1. JavaScript 参考手册——javascript本地和内置对象、BOM、DOM

    本部分提供完整的 JavaScript 参考手册: JavaScript 本地对象和内置对象 Browser 对象(BOM) HTML DOM 对象 JavaScript 对象参考手册 本参考手册描述 ...

  2. [转]linux下svn命令大全

    FROM:http://www.jb51.net/os/RedHat/2461.html 1.将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:s ...

  3. 最新版EJS的include函数已支持参数传递

    最新版的express中partial函数已经被移除,使用include虽然可以实现同样的效果,但是代码看起来很不爽比如 1 <%-partial("user/home",{ ...

  4. hdu1019 Least Common Multiple

    Problem Description The least common multiple (LCM) of a set of positive integers is the smallest po ...

  5. ACM: POJ 3259 Wormholes - SPFA负环判定

     POJ 3259 Wormholes Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu   ...

  6. 51Nod 1256 乘法逆元 Label:exgcd

    1256 乘法逆元 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 给出2个数M和N(M < N),且M与N互质,找出一个数K满足0 < K < N且K ...

  7. Java中集合Set的用法

    转载 http://blog.163.com/asd_wll/blog/static/210310402010112833332260/ 1.HashSet类 Java.util.HashSet类实现 ...

  8. 【BZOJ】2216: [Poi2011]Lightning Conductor

    题意 给一个长度为\(n\)的序列\(a_i\),对于每个\(1 \le i \le n\),找到最小的非负整数\(p\)满足 对于任意的\(j\), \(a_j \le a_i + p - \sqr ...

  9. SDL2.0学习

    http://www.ffmpeg.org/download.html http://doc.okbase.net/leixiaohua1020/archive/110977.html  //视频 h ...

  10. Java_java动态编译整个项目,解决jar包找不到问题

    java动态编译整个项目,解决jar包找不到问题原文:http://itzyx.com/index.php/javac/ 动态将java文件编译为class文件解决方案:将temp\sdl\src目录 ...