首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在WPF中加载CrystalReports到ReportViewer?

如何在WPF中加载CrystalReports到ReportViewer?
EN

Stack Overflow用户
提问于 2018-04-02 17:59:54
回答 1查看 48关注 0票数 1

我搜索了一下,很明显,可以使用'ReportSource‘属性和一个ReportDocument来实现,但由于某种原因,我没有这个属性。

我安装了CrystalReports并打开了一个新项目(WPF CrystalReports)。该项目附带了CrystalReports1.rpt和.cs,以及内部带有CrystalReportsViewer的MainWindow。我检查了不同的属性,但找不到任何可以填充它的东西。

EN

回答 1

Stack Overflow用户

发布于 2018-04-02 18:11:47

这是我的一些非常老的代码。我不认为您需要设置datatable的名称,因为它适用于列表。

代码语言:javascript
复制
    // DataTable could instead be a collection whose type properties match the report

    ReportDocument rd;
   //  Make the name of the datatable match what the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load("blaa.rpt");
    rd.SetDataSource(dt);

    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    CrystalReportViewer1.DisplayGroupTree = false;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49609147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档