本文整理汇总了C#中LocalReport.LoadSubreportDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.LoadSubreportDefinition方法的具体用法?C# LocalReport.LoadSubreportDefinition怎么用?C# LocalReport.LoadSubreportDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalReport
的用法示例。
在下文中一共展示了LocalReport.LoadSubreportDefinition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSubReport
// Reports Load
public static void LoadSubReport(LocalReport rpt, string reportName, string reportPath)
{
rpt.LoadSubreportDefinition(reportName, File.OpenRead(reportPath));
}
示例2: Generate
public void Generate(Models.ReportModel reportModel, string destinationPath)
{
using (LocalReport localReport = new LocalReport())
{
localReport.DataSources.Add(new ReportDataSource("DataSet1", reportModel.MidYearReportData));
Func<string, System.IO.FileStream> openReadOnlyStream =
(file) => System.IO.File.Open(file, System.IO.FileMode.Open, System.IO.FileAccess.Read);
localReport.LoadSubreportDefinition("StatsChart",
System.IO.StringReader.Synchronized(new System.IO.StreamReader(this.definitions.StatsChartPath)));
localReport.LoadSubreportDefinition("CognitiveReportsUnlocked",
System.IO.StringReader.Synchronized(new System.IO.StreamReader(this.definitions.CognitiveReportsUnlockedPath)));
localReport.LoadSubreportDefinition("StudentsOnTrack",
System.IO.StringReader.Synchronized(new System.IO.StreamReader(this.definitions.StudentsOnTrackPath)));
localReport.LoadSubreportDefinition("CognitiveWeaknesses",
System.IO.StringReader.Synchronized(new System.IO.StreamReader(this.definitions.CognitiveWeaknessesPath)));
localReport.LoadSubreportDefinition("LeadingCohorts",
System.IO.StringReader.Synchronized(new System.IO.StreamReader(this.definitions.LeadingCohortsPath)));
SubreportProcessingEventHandler processSubreport = (s, e) =>
{
if (e.ReportPath == "StatsChart")
{
e.DataSources.Add(new ReportDataSource("DataSet1", reportModel.BasicStats));
}
if (e.ReportPath == "CognitiveReportsUnlocked")
{
e.DataSources.Add(new ReportDataSource("DataSet1", reportModel.UnlockedReports));
}
if (e.ReportPath == "StudentsOnTrack")
{
e.DataSources.Add(new ReportDataSource("DataSet1", reportModel.OnTrack));
}
if (e.ReportPath == "CognitiveWeaknesses")
{
e.DataSources.Add(new ReportDataSource("DataSet1", reportModel.CognitiveWeakness));
}
if (e.ReportPath == "LeadingCohorts")
{
e.DataSources.Add(new ReportDataSource("DataSet1", reportModel.LeadingCohorts));
}
};
localReport.SubreportProcessing += processSubreport;
localReport.ReportPath = this.definitions.MidYearReportPath;
byte[] completedReport = localReport.Render("PDF");
using (var writer = new System.IO.FileStream(destinationPath, System.IO.FileMode.Create))
{
writer.Write(completedReport, 0, completedReport.Count());
}
localReport.SubreportProcessing -= processSubreport;
}
}