我搜索了一下,很明显,可以使用'ReportSource‘属性和一个ReportDocument来实现,但由于某种原因,我没有这个属性。
我安装了CrystalReports并打开了一个新项目(WPF CrystalReports)。该项目附带了CrystalReports1.rpt和.cs,以及内部带有CrystalReportsViewer的MainWindow。我检查了不同的属性,但找不到任何可以填充它的东西。
发布于 2018-04-02 18:11:47
这是我的一些非常老的代码。我不认为您需要设置datatable的名称,因为它适用于列表。
// 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;https://stackoverflow.com/questions/49609147
复制相似问题