Dav*_*her 8 c# report crystal-reports
我想创建一个报告,使用Crystal报告或RDLC,并不重要.我可以将所有数据源组合在一起作为一系列动态生成的文本框等,但如何将其添加到报表中?
例如,我希望在报告中显示客户名称及其所有订购商品.现在我可以获得数组中的所有信息......然后我将如何将其放入Crystal Report中?
任何涵盖Crystal Reports非向导的好介绍都会令人惊叹.
报告的每个数据源都有一个名称(菜单报告->数据源,它可能不准确,因为我的 vs 不是英文的)。
假设您的数据源名称之一是 prj_folder_classSample,而 classSample 是您项目的一个类。然后您需要将列表添加到报告中。
我们开始做吧。
List<classSanple> lst = new List<classSample>
lst.Add(...) //Add various instances of classSample
BindingSource thisIsABindingSource = new BindingSource();
thisIsABindingSource.DataSource = lst;
reportDataSource rds = new ReportDataSource("prj_folder_classSample", thisIsABindingSource);
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.EnableExternalImages = true;
ReportViewer1.LocalReport.ReportEmbeddedResource = "YourProject.Folder.reportName.rdlc";
ReportViewer1.LocalReport.DataSources.Add(rds)
Run Code Online (Sandbox Code Playgroud)
我就是这样做的。希望对您有帮助。