예제 #1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            var rv = new ReportViewer {
                Dock = DockStyle.Fill
            };

            rv.LocalReport.ReportEmbeddedResource = "PeriodicTable.Report.Report1.rdlc";
            Controls.Add(rv);

            rv.LocalReport.DataSources.Add(
                new ReportDataSource("DataSet1", MainTableDataSource.Create()));
            rv.LocalReport.DataSources.Add(
                new ReportDataSource("DataSet2", SubTableDataSource.Create()));

            rv.RefreshReport();
        }
        public override void Run()
        {
            var dataSetForMainTable = CreateDataSet();
            var mainTable           = MainTable.Create(dataSetForMainTable.Name);
            var dataSetForSubTable  = CreateDataSet();
            var subTable            = SubTable.Create(dataSetForSubTable.Name);
            var body = new Body();

            body.AddReportItem(mainTable);
            body.AddReportItem(subTable);
            Report.AddReportSection(new ReportSection(body));

            Report.AddDataSet(dataSetForMainTable);
            Report.AddDataSet(dataSetForSubTable);
            DataSources.Add(new ReportDataSource(dataSetForMainTable.Name, MainTableDataSource.Create()));
            DataSources.Add(new ReportDataSource(dataSetForSubTable.Name, SubTableDataSource.Create()));

            CreateEmbeddedImages();

            base.Run();
        }