您好,理解您的意思是,现在想了解 基于代码的区域报表及传参问题。
AR 提供三大类型报表报表,基于代码的区域报表(.cs),基于模板的区域报表(.rpx); 页面\RDL 报表(.rdlx)
不同类型的报表,加载方式不同:
基于代码.cs
// 创建的报表,可当作类来使用
SectionReportName sr=New SectionReportName()
sr.Run();
传参:
srt.Parameters[0].DefaultValue = "123";
基于模板.rpx
- // Create a Section report.GrapeCity.ActiveReports.SectionReport rpt = new GrapeCity.ActiveReports.SectionReport();
- // For the code to work, report.rpx must be placed in the bin\debug folder of your project.
- System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Application.StartupPath + "\\report.rpx");
- rpt.LoadLayout(xtr);
- rpt.Run();
复制代码 传参:
srt.Parameters[0].DefaultValue = "123";
页面\RDL 报表
- // Create a page/Rdl report.
- GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport();
- // Load the report you want to export.
- // For the code to work, this report must be stored in the bin\debug folder of your project.
- rpt.Load(new System.IO.FileInfo ("report.rdlx"));
- GrapeCity.ActiveReports.Document.PageDocument MyDocument = new GrapeCity.ActiveReports.Document.PageDocument (rpt);
复制代码
传参:
rpt.Report.ReportParameters[0].DefaultValue.Values.Add( "123");
|