Exemplo n.º 1
0
        //
        /// <summary>
        /// Some values in the Datastructure are not set (means they are null), you can handle this values by setting
        /// the NullValue in the properties of this Item, or, you can use the SectionRenderingEvent as shown
        /// below
        /// </summary>
        /// <param name="fileName"></param>
        private void RunContributors(string fileName)
        {
            ReportModel model = ReportEngine.LoadReportModel(fileName);
//			Console.WriteLine(model.ReportSettings.PageSize);
//			model.ReportSettings.PageSize = new Size(model.ReportSettings.PageSize.Width,400);
//			Console.WriteLine(model.ReportSettings.PageSize);

            // sorting is done here, but, be carefull, misspelled fieldnames will cause an exception

            //ReportSettings settings = model.ReportSettings;
            //settings.SortColumnCollection.Add(new SortColumn("First",System.ComponentModel.ListSortDirection.Ascending));

            // Both variable declarations  are valid

            ContributorCollection contributorCollection = ContributorsReportData.CreateContributorsList();
            IDataManager          dataManager           = DataManager.CreateInstance(contributorCollection, model.ReportSettings);

//			List<Contributor> list = ContributorsReportData.CreateContributorsList();
//			IDataManager dm = DataManager.CreateInstance(list,model.ReportSettings);


            this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e)
            {
                this.previewControl1.RunReport(model, dataManager);
            };
            this.previewControl1.RunReport(model, dataManager);
        }
Exemplo n.º 2
0
        // Can use this version for Parameters as well

        private void V2_RunContributorsWithParameters(string fileName)
        {
            var model = ReportEngine.LoadReportModel(fileName);
            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list        = ContributorsReportData.CreateContributorsList();
            IDataManager       dataManager = DataManager.CreateInstance(list, model.ReportSettings);

            this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e)
            {
                this.previewControl1.RunReport(model, dataManager);
            };
            this.previewControl1.RunReport(model, dataManager);
        }
Exemplo n.º 3
0
        private void V1_RunContributorsWithParameters(string fileName)
        {
            ReportModel model = ReportEngine.LoadReportModel(fileName);

            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list = ContributorsReportData.CreateContributorsList();


            this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e)
            {
                this.previewControl1.RunReport(model, list, parameters);
            };
            this.previewControl1.RunReport(model, list, parameters);
        }
Exemplo n.º 4
0
        private void RunContributorsWithParameters(string fileName)
        {
            var model = ReportEngine.LoadReportModel(fileName);
            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list = ContributorsReportData.CreateContributorsList();

            IReportCreator creator = ReportEngine.CreatePageBuilder(model, list, parameters);

            creator.SectionRendering += PushPrinting;
            creator.BuildExportList();
            using (PdfRenderer pdfRenderer = PdfRenderer.CreateInstance(creator, SelectFilename(), true))
            {
                pdfRenderer.Start();
                pdfRenderer.RenderOutput();
                pdfRenderer.End();
            }
        }